How can I add rows to a listview asynchronously?

Viewed 2971

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 ArrayAdapter from an AsyncTask with OnProgressUpdate?
  • Do I have to issue a notifyDatasetChanged() after each added row?
  • Is the Fragment/Loader approach 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)

3 Answers
Related