How to use notifyDataSetChanged() in thread
Use runOnUiThread()
method to execute the UI action from a Non-UI thread.
private class ReceiverThread extends Thread {
@Override
public void run() {
Activity_name.this.runOnUiThread(new Runnable() {
@Override
public void run() {
mAdapter.notifyDataSetChanged();
}
});
}
You can not touch the views of the UI from other thread. For your problem you can use either AsyncTask, runOnUiThread or handler.
All The Best