I am calling a webservice through asynctask, to call the webservice i am calling one method named makeRequest() in
Since this the error that comes up when you do some MainThread task in another thread.....
try This:
runOnUiThread(new Runnable(){
public void run(){
this.adapter.setList(list);
this.adapter.notifyDataSetChanged();
}
});
This code might have some errors But in simple Words.. add the notifyDataSetChanged call into runOnUiThread() method. You will be Done..
OR this can also be DOne ( the perfect way )
add the following in your activity class
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
this.adapter.setList(list);
adapter.setnotifyDataSetChanged();
}
};
Call this handler when and where you want to call the notifydatasetchanged like this
handler.sendEmptyMessage(0);
Thanks sHaH