I am populating the ListView from my Custom DataAdaptor. I have a layout defined for each item/row of the listview. Inside that ListView i have an AutoCompleteTextView. I need to bind it with data from SQLite database. Actually this AutoCompleteTextView will list categories & these categories will come from a SQLite Table.I can bind it in my Custom DatAdapeter class inside getView() but i don't know how to avoid the multiple calls to the SQLite database?
As the categories will remain the same for each row so i want to get the Categories just once from the database & bind it with AutoCompleteTextView in each row.
Can someone guide me how to do it?
Regards.
To avoid multiple database calls ..
You can fetch data in cursor from database in your activity's
onCreate()
then usingCursorAdapter
orSimpleCursorAdapter
bind it (using setAdapter) toAutoCOmpleteTextView
in your list Adapter'sgetView()
..This example will help you lot Using AutocompleteTextView with SQLite and CursorAdapter