I need to populate a long ListView with data from the network, say 2-3 seconds for the entire data collection. I don’t want the user to see a loading Dialog and wait for the entire list download. Instead I want to update the ListView as each item becomes available.
- How can I do this?
- I presume by adding to the
ArrayAdapterfrom anAsyncTaskwithOnProgressUpdate? - Do I have to issue a
notifyDatasetChanged()after each added row? - Is the
Fragment/Loaderapproach better? - Is there a tutorial or API demo reference implementation for a case
like this?
It’s not important that the data be fetched entirely before the Activity dies (ie Service is unnecessary)
The best approach I’ve seen so far is from CommonsWare. It was found in this related answer.
Apparently there is nothing wrong with calling
addwithoutnotifyDatasetChanged().