开发者

Android ListAdapter Repaint

开发者 https://www.devze.com 2022-12-23 22:57 出处:网络
i have the following problem. I fill a ListView with a custom ArrayAdapter with 开发者_如何学Cdata from a BD. However, in background, i\'m updating those datas from the info provided by an API, so the

i have the following problem. I fill a ListView with a custom ArrayAdapter with 开发者_如何学Cdata 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


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()

0

精彩评论

暂无评论...
验证码 换一张
取 消