Use managedQuery to let Search Activity automatically dispose of it's Cursor.
Should be somehow done via Loaders someday.
This commit is contained in:
parent
793bd618ac
commit
c1daa99617
@ -47,6 +47,7 @@ public class SearchResults extends ListActivity {
|
|||||||
|
|
||||||
private static final int SEARCH = Menu.FIRST;
|
private static final int SEARCH = Menu.FIRST;
|
||||||
|
|
||||||
|
private Cursor cursor;
|
||||||
private AppListAdapter adapter;
|
private AppListAdapter adapter;
|
||||||
|
|
||||||
protected String getQuery() {
|
protected String getQuery() {
|
||||||
@ -107,10 +108,12 @@ public class SearchResults extends ListActivity {
|
|||||||
if (query == null || query.length() == 0)
|
if (query == null || query.length() == 0)
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
Cursor cursor = getContentResolver().query(
|
if (cursor != null) cursor.close();
|
||||||
|
cursor = managedQuery(
|
||||||
AppProvider.getSearchUri(query), AppListFragment.APP_PROJECTION,
|
AppProvider.getSearchUri(query), AppListFragment.APP_PROJECTION,
|
||||||
null, null, AppListFragment.APP_SORT);
|
null, null, AppListFragment.APP_SORT);
|
||||||
|
|
||||||
|
|
||||||
TextView tv = (TextView) findViewById(R.id.description);
|
TextView tv = (TextView) findViewById(R.id.description);
|
||||||
String headertext;
|
String headertext;
|
||||||
int count = cursor != null ? cursor.getCount() : 0;
|
int count = cursor != null ? cursor.getCount() : 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user