I would like to put a large number of add delete calculation work on the worker thread, notifyDataSetChanged work on the ui thread. On the basis of it to avoid the java.lang.IllegalStateException. Exception as follows: java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. Make sure your adapter calls notifyDataSetChanged() when its content changes.
code shorthand such as:
new Thread(){
            @Override
            public void run() {
                for(int i=0; i<5000; i++){
                    mDatas.add(i);
                }
                mActivity.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        mAdapter.notifyDataSetChanged();
                    }
                });
            }
        }.start();
I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
 
     
     
    