Skip to content

Commit

Permalink
Remove WebView from view system before destroying per documentation f…
Browse files Browse the repository at this point in the history
…or WebView:

http://developer.android.com/reference/android/webkit/WebView.html#destroy()
"This method should be called after the WebView has been removed from the view
system."

In rare circumstances, destroying without removing from the view system could
crash the app.
  • Loading branch information
wac- committed Jan 25, 2011
1 parent e8373da commit fbfefad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/com/andrewshu/android/reddit/BrowserActivity.java
Expand Up @@ -9,6 +9,7 @@
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.webkit.CookieSyncManager;
import android.webkit.WebChromeClient;
Expand Down Expand Up @@ -126,6 +127,8 @@ public void onPause() {
@Override
public void onDestroy() {
super.onDestroy();
// Must remove the WebView from the view system before destroying.
webview.setVisibility(View.GONE);
webview.destroy();
webview = null;
}
Expand Down

0 comments on commit fbfefad

Please sign in to comment.