Fixed occasional IllegalStateException

This commit is contained in:
Anthony Restaino 2015-01-30 22:50:15 -05:00
parent 6407f1101a
commit 0e212539e9

View File

@ -149,6 +149,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
mFilteredList.clear(); mFilteredList.clear();
mFilteredList.addAll(list); mFilteredList.addAll(list);
} }
notifyDataSetChanged();
} }
@Override @Override
@ -193,7 +194,6 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
} }
mHistory = mDatabaseHandler.findItemsContaining(constraint.toString()); mHistory = mDatabaseHandler.findItemsContaining(constraint.toString());
mFilteredList = getSuggestions();
results.count = 1; results.count = 1;
return results; return results;
} }
@ -205,6 +205,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
@Override @Override
protected void publishResults(CharSequence constraint, FilterResults results) { protected void publishResults(CharSequence constraint, FilterResults results) {
mFilteredList = getSuggestions();
notifyDataSetChanged(); notifyDataSetChanged();
} }