Hi,
I have successfully implemented a custom SimpleCursorAdapter for an AutoCompleteTextView, which suggests entries from the database according to what has been entered into the box. However, I am getting the following non-fatal errors:
An exception occured during performFiltering()!
java.lang.NullPointerException
at com.stev.LondonTaxi.Route.runQuery(Route.java:456)
at com.stev.LondonTaxi.AutocompleteAdapter.runQueryOnBackgroundThread(AutocompleteAdapter.java:61)
Relevant extracts from my code are below - I wonder if anyone might be able to shed any light?
public class Route extends Activity implements View.OnClickListener,
AdapterView.OnItemClickListener, FilterQueryProvider {
from_adapt.setFilterQueryProvider(this);
public Cursor runQuery(CharSequence constraint) {
String filter = constraint.toString().toUpperCase() + "%'";
Cursor all_Cursor_filter = dbse.autocomplete_query(filter);
return all_Cursor_filter;
}
public class AutocompleteAdapter extends SimpleCursorAdapter implements Filterable {
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
if (getFilterQueryProvider() != null)
{ return getFilterQueryProvider().runQuery(constraint); }
return dbAdapt.autocomplete_query();
}
Steve