views:

214

answers:

1

Hi,

i have the following problem. I fill a ListView with a custom ArrayAdapter with data from a BD. However, in background, i'm updating those datas from the info provided by an API, so the idea is when the update finish, the adapter shows the updated data instead its "old version".

The problem is that when i do that, i notice a lag while the adapter is updating itself. Is the any efficient solution to avoid this?

Thanks

+2  A: 

You can call notifyDataSetChanged() on your ListAdapter to cause it to update to the current data immediately. Note that you should do this from the main UI thread, using a Handler or Activity.runOnUIThread()

synic