fixed bug in search adapter

This commit is contained in:
Anthony Restaino 2015-07-29 22:46:59 -04:00
parent 399037d49b
commit 71fcd174d7
2 changed files with 2 additions and 2 deletions

View File

@ -65,7 +65,7 @@ public class HistoryDatabase extends SQLiteOpenHelper {
onCreate(db);
}
private boolean isClosed() {
public boolean isClosed() {
return mDatabase == null || !mDatabase.isOpen();
}

View File

@ -232,7 +232,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
}
}
if (mDatabaseHandler == null) {
if (mDatabaseHandler == null || mDatabaseHandler.isClosed()) {
mDatabaseHandler = HistoryDatabase.getInstance(mContext.getApplicationContext());
}
List<HistoryItem> historyList = mDatabaseHandler.findItemsContaining(constraint.toString());