« Importing upstream tarballs in Debian with gbp import-orig | Home | How to get the classic Firefox look back »
Fixing IllegalStateException: The content of the adapter has changed but ListView did not receive a notification
By admin | November 16, 2013
Recently while working with a custom BaseAdapter in ListView, I came across this error:
E/InputEventReceiver(30380): Exception dispatching input event. E/MessageQueue-JNI(30380): Exception in MessageQueue callback: handleReceiveCallback E/MessageQueue-JNI(30380): 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. [in ListView(2131230721, class android.widget.ListView) with Adapter(class com.compdigitec.libvlcandroidsample.DirectoryAdapter)] E/MessageQueue-JNI(30380): at android.widget.ListView.layoutChildren(ListView.java:1544) E/MessageQueue-JNI(30380): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3403) E/MessageQueue-JNI(30380): at android.view.View.dispatchTouchEvent(View.java:7239) E/MessageQueue-JNI(30380): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2168) E/MessageQueue-JNI(30380): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1903) E/MessageQueue-JNI(30380): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) E/MessageQueue-JNI(30380): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) E/MessageQueue-JNI(30380): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) E/MessageQueue-JNI(30380): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) E/MessageQueue-JNI(30380): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) E/MessageQueue-JNI(30380): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) E/MessageQueue-JNI(30380): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) E/MessageQueue-JNI(30380): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) E/MessageQueue-JNI(30380): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953) E/MessageQueue-JNI(30380): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1405) E/MessageQueue-JNI(30380): at android.app.Activity.dispatchTouchEvent(Activity.java:2410) E/MessageQueue-JNI(30380): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1901) E/MessageQueue-JNI(30380): at android.view.View.dispatchPointerEvent(View.java:7419) E/MessageQueue-JNI(30380): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3220) E/MessageQueue-JNI(30380): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3165) E/MessageQueue-JNI(30380): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4292) E/MessageQueue-JNI(30380): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4271) E/MessageQueue-JNI(30380): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4363) E/MessageQueue-JNI(30380): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179) E/MessageQueue-JNI(30380): at android.os.MessageQueue.nativePollOnce(Native Method) E/MessageQueue-JNI(30380): at android.os.MessageQueue.next(MessageQueue.java:125) E/MessageQueue-JNI(30380): at android.os.Looper.loop(Looper.java:124) E/MessageQueue-JNI(30380): at android.app.ActivityThread.main(ActivityThread.java:5191) E/MessageQueue-JNI(30380): at java.lang.reflect.Method.invokeNative(Native Method) E/MessageQueue-JNI(30380): at java.lang.reflect.Method.invoke(Method.java:511) E/MessageQueue-JNI(30380): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) E/MessageQueue-JNI(30380): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562) E/MessageQueue-JNI(30380): at dalvik.system.NativeStart.main(Native Method)
this.notifyDataSetChanged() was already being called, so that couldn’t have been the problem.
The solution?
If registerDataSetObserver() and unregisterDataSetObserver() are going to be overridden, ensure that the superclass’ methods are being called too. If you forget to call them, then when Android registers the ListView dataset observer, nothing is going to happen.
@Override
public void registerDataSetObserver(DataSetObserver arg0) {
// ...stuff
super.registerDataSetObserver(arg0);
}
@Override
public void unregisterDataSetObserver(DataSetObserver arg0) {
// ...stuff
super.unregisterDataSetObserver(arg0);
}
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!
Topics: Mobile | 15 Comments »

August 1st, 2025 at 20:57
… [Trackback]
[…] Read More Information here on that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
August 3rd, 2025 at 03:46
… [Trackback]
[…] Find More on that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
August 5th, 2025 at 20:39
… [Trackback]
[…] Find More Info here to that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
August 6th, 2025 at 18:21
… [Trackback]
[…] Find More Info here on that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
August 11th, 2025 at 07:01
… [Trackback]
[…] Find More on on that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
August 13th, 2025 at 05:35
… [Trackback]
[…] Information on that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
August 19th, 2025 at 17:00
… [Trackback]
[…] Read More to that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
August 27th, 2025 at 12:45
… [Trackback]
[…] Find More Information here to that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
August 31st, 2025 at 21:57
… [Trackback]
[…] Find More to that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
September 21st, 2025 at 18:45
… [Trackback]
[…] Read More Information here on that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
September 22nd, 2025 at 20:06
… [Trackback]
[…] Read More here to that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
September 26th, 2025 at 02:40
… [Trackback]
[…] Read More Info here on that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
September 30th, 2025 at 15:54
… [Trackback]
[…] There you will find 10764 additional Info to that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
October 4th, 2025 at 11:25
… [Trackback]
[…] Find More Information here to that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]
October 24th, 2025 at 21:30
… [Trackback]
[…] There you will find 38684 more Information on that Topic: compdigitec.com/labs/2013/11/16/fixing-illegalstateexception-the-content-of-the-adapter-has-changed-but-listview-did-not-receive-a-notification/ […]