summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2010-12-06 11:19:48 -0800
committerJohn Reck <jreck@google.com>2010-12-06 12:32:33 -0800
commit3f83159b1cd8c732337d966be575233f0d1cae90 (patch)
treebc9bd84441ee316c00324e5994438eb14d3d7141
parenta755c61400e995ab059ecd1d40a2f2b32b4370ed (diff)
downloadpackages_apps_browser-3f83159b1cd8c732337d966be575233f0d1cae90.zip
packages_apps_browser-3f83159b1cd8c732337d966be575233f0d1cae90.tar.gz
packages_apps_browser-3f83159b1cd8c732337d966be575233f0d1cae90.tar.bz2
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
-rw-r--r--src/com/android/browser/BrowserHistoryPage.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java
index 2fdfedd..e9db667 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();
}
}