Android, ListView IllegalStateException: “The content of the adapter has changed but ListView did not receive a notification”

后端 未结 25 2350
执念已碎
执念已碎 2020-11-22 16:59

What I want to do: run a background thread which calculates ListView contents and update ListView partially, while results are calculated.

W

25条回答
  •  长发绾君心
    2020-11-22 17:50

    Like @Mullins said "
    I both added the items and called notifyDataSetChanged() in the UI thread and I resolved this. – Mullins".

    In my case I have asynctask and I called notifyDataSetChanged() in the doInBackground() method and the problem is solved, when I called from onPostExecute() I received the exception.

提交回复
热议问题