From 3f83159b1cd8c732337d966be575233f0d1cae90 Mon Sep 17 00:00:00 2001 From: John Reck Date: Mon, 6 Dec 2010 11:19:48 -0800 Subject: Fixes crash when clearing history Bug: 3253556 The dialog to clear the history was trying to reference the fragment creating it, however that fragment was being destroyed. Fixed this by hanging on to the ContentResolver instead of trying to call getActivity() Change-Id: Ie46fd4cc34e7034ce9a21a6b8856041f8d350f17 --- src/com/android/browser/BrowserHistoryPage.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/com/android/browser/BrowserHistoryPage.java') diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java index 2fdfedd30..e9db66790 100644 --- a/src/com/android/browser/BrowserHistoryPage.java +++ b/src/com/android/browser/BrowserHistoryPage.java @@ -22,6 +22,7 @@ import android.app.Dialog; import android.app.Fragment; import android.app.LoaderManager.LoaderCallbacks; import android.content.ClipboardManager; +import android.content.ContentResolver; import android.content.Context; import android.content.CursorLoader; import android.content.DialogInterface; @@ -221,6 +222,7 @@ public class BrowserHistoryPage extends Fragment public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.clear_history_menu_id: + final ContentResolver resolver = getActivity().getContentResolver(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) .setTitle(R.string.clear) .setMessage(R.string.pref_privacy_clear_history_dlg) @@ -230,7 +232,7 @@ public class BrowserHistoryPage extends Fragment @Override public void onClick(DialogInterface dialog, int which) { if (which == DialogInterface.BUTTON_POSITIVE) { - Browser.clearHistory(getActivity().getContentResolver()); + Browser.clearHistory(resolver); mCallbacks.onRemoveParentChildRelationships(); } } -- cgit v1.2.3