mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Don't hold on to cursor for whole BookmarkPickerActivity lifecycle as it may become stale
This commit is contained in:
parent
2a07421ada
commit
431806c896
|
@ -19,7 +19,6 @@ package com.google.zxing.client.android.share;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.provider.Browser;
|
import android.provider.Browser;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -49,8 +48,8 @@ public final class BookmarkPickerActivity extends ListActivity {
|
||||||
private Cursor cursor;
|
private Cursor cursor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle icicle) {
|
protected void onResume() {
|
||||||
super.onCreate(icicle);
|
super.onResume();
|
||||||
cursor = getContentResolver().query(Browser.BOOKMARKS_URI, BOOKMARK_PROJECTION,
|
cursor = getContentResolver().query(Browser.BOOKMARKS_URI, BOOKMARK_PROJECTION,
|
||||||
BOOKMARK_SELECTION, null, null);
|
BOOKMARK_SELECTION, null, null);
|
||||||
if (cursor == null) {
|
if (cursor == null) {
|
||||||
|
@ -62,11 +61,12 @@ public final class BookmarkPickerActivity extends ListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onPause() {
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
cursor = null;
|
||||||
}
|
}
|
||||||
super.onDestroy();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue