I have an activity which has two inputs : one for city and the other for location. I am storing the city and location information in sqlite table whenever the user request a search operation.
Now, i want whenever the user inputs the city(which is a autosuggest), the autosuggest options in location should automatically update. The input widget for location and city are both AutoCompleteTextView.
How can this be done?
Rgds,
Sapan
you just need to provide a CursorAdapter to the AutoCompleteTextView, e.g. a SimpleCursorAdapter (though the SimpleCursorAdapter was buggy when i tried it).
the
getCityCursor();method should provide a cursor obtained by aSQLiteDatabase.query().update: the “buggy” SimpleCursorAdapter i mentioned earlier isn’t. just provide a
CursorToStringConverter. dan breslau wrote a pretty nice article about AutoCompleteTextView and the SimpleCursorAdapter here.