由网友(丿缒风灬双鱼)分享简介:我有一个单独的线程运行从互联网上获取数据。在那之后,我想通过调用adapter.notifyDataSetChanged更新在主线程中的ListView()。但是,这是行不通的。任何解决办法是什么?谢谢你。I have a separate thread running to get data from the in...
我有一个单独的线程运行从互联网上获取数据。在那之后,我想通过调用adapter.notifyDataSetChanged更新在主线程中的ListView()。但是,这是行不通的。任何解决办法是什么?谢谢你。
I have a separate thread running to get data from the internet. After that, I would like to update the ListView in the main thread by calling adapter.notifyDataSetChanged(). But it does not work. Any workaround for that? Thanks.
推荐答案
使用AsyncTask的(http://developer.android.com/reference/android/os/AsyncTask.html )。
Use AsyncTask ( http://developer.android.com/reference/android/os/AsyncTask.html ).
调用的 adapter.notifyDataSetChanged()的中的 onPostExecute(...)的方法。
有关详细信息,请阅读:http://android-developers.blogspot.com/2009/05/painless-threading.html
For more details, please read this: http://android-developers.blogspot.com/2009/05/painless-threading.html
相关推荐
最新文章