Created
February 22, 2018 02:14
-
-
Save rosuH/15c15b066434de764e18a04f7d9c933f to your computer and use it in GitHub Desktop.
Avoid webview memory leaks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onDestroy() { | |
if(mWebView !=null ){ | |
mWebView.loadDataWithBaseURL(null, "", "text/html", | |
"utf-8", null); | |
((ViewGroup)mWebView.getParent()).removeView(mWebView); | |
mWebView.destroy(); | |
mWebView = null; | |
} | |
super.onDestroy(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment