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().
精彩评论