Reputation: 8332
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 the best practice?
Upvotes: 0
Views: 657
Reputation: 9189
If you are only showing your list at the end call notifyDataSetChanged() in onPostExecute().
Upvotes: 2