How To Call Notifydatasetchanged() From Asynctask Onpostexecute() In Another Class
In onCreate() I am calling a class ChannelStore to create a singleton and my fragment's listview is using that dataset created by channelstore. Once the doInBackground() finishes I
Solution 1:
If in onPostExecute you can access your dataset created by channelstore and your adapter, you can change your dataset and update your adapter by calling notifyDateSetChanged(). another way to do it is use
runOnUiThread(new Runnable() {
publicvoidrun() {
// your code to update adapter.
}
});
in every where that you need to access ui thread to update something. your onPostExecute always runs on UI thread so you have access your fragment adapter. in order to do that you can use
getFragmentManager().getFragmentByTag('your fragment tag').ChannelAdapter.notifyDataSetChanged()
Post a Comment for "How To Call Notifydatasetchanged() From Asynctask Onpostexecute() In Another Class"