开发者

Android - Best practice to update ListView

Here is my adapter

lv = (ListView)findViewById(R.id.vlist);
adapter = new TestAdapter(context, R.id.vlist, data); 
lv.setAdapter(adapter);

I popular data in an AsyncTask class. So where is the best place I should call:

adapter.notifyDataSetChanged();

I think I will pass adapter as a parameter into AsyncTask instance and call data changed in onPostExecute. Is it t开发者_如何转开发he best practice?


If you are only showing your list at the end call notifyDataSetChanged() in onPostExecute().

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜