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();
        }
    });
}

Leave a Comment