I have a listview which loads its data from sqlite database.
Each row in listview has image , textview and a checkbox.
The sqlitedatabase rows has image and text data + some other columns.
My question is can I bind my listview with the database so that all rows will be loaded with required data automatically. (image + textview) There are examples to bind a simple list of textviews. What about complex rows ? Also there are few spinners which can filter the data in list depending on its value. (Which act as a WHERE clause on my DB)
Currently I am managing this all by generating the view for my custom adapter for each row. So each time I query database and populate data. I hold the last listview results , make a newer results based on actions/conditions like spinner values, then notifydatachanged to adapter to load my new results.
To add features like DELETE , ADD , SEARCH — I have to manage it all using collections.
Is there any simple way of doing this ? As if the db is large then the approach of holding such huge set of results in memory is not good. And is painful for managing it.
Thanks.
Here is my example for row, constructed from two records from db + image (at current – one image for any row, but it can be improved for specific image from db):
and using this adapter:
and layout: