Hi all,
With the application i am working on i came with the following problem. I have a listview that should display data from a data base table. There are two scenarios that could happen:
- Scenario one - the database table is filling dynamically and the listview also should dynamically display table's information e.g to grow depending on table size.
- Scenario two - the table has been already filled and the listview has to just display the content
So the problem is how to accomplish this behavior using ListView and ListAdapter.
So far i have solution for each scenario but no for the two together.
- Scenario one - Use AsyncTask and ArrayAdapter. In doInBackGround query the db periodically and pass the result to onProgressUpdate, than just fill the ArrayAdapter with the newly added values. But when came scenario two i query all the table than copy all values to the ArrayAdapter in one step which is pretty slow.
- Scenario two - Query the db again the just use CursorAdapter. But in this case i can't update the ListView dynamically using CursorAdapter.
So any ideas how to implement this using one adapter, or just should i use ArrayAdapter and CursorAdapter depending on the case ?