Compdigitec Labs

« | Home | »

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 | 11 Comments »

11 Responses to “Fixing IllegalStateException: The content of the adapter has changed but ListView did not receive a notification”

  1. บริการบิวท์อิน เชียงใหม่ Says:
    July 13th, 2026 at 22:51

    … [Trackback]

    […] Read More 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/ […]

  2. รับทำบัญชี Says:
    July 20th, 2026 at 10:07

    … [Trackback]

    […] There you can find 41571 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/ […]

  3. คาสิโนเกาหลี Says:
    July 31st, 2026 at 02:15

    … [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/ […]

  4. โคมไฟ Says:
    August 9th, 2026 at 04:31

    … [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/ […]

  5. คลินิกความงาม ขอนแก่น Says:
    August 12th, 2026 at 01:43

    … [Trackback]

    […] Here you can find 62583 additional 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/ […]

  6. คอนโดมือสอง Says:
    August 18th, 2026 at 23:02

    … [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/ […]

  7. เทปใส Says:
    September 3rd, 2026 at 05:07

    … [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/ […]

  8. 如何登录WhatsApp网页版 Says:
    September 6th, 2026 at 15:28

    … [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/ […]

  9. Paper Core Manufacturer Says:
    September 11th, 2026 at 16:21

    … [Trackback]

    […] Read 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/ […]

  10. order B+ mushrooms Norway 2026 Says:
    September 12th, 2026 at 02:13

    … [Trackback]

    […] There you will find 16021 additional Information 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/ […]

  11. เสากั้นทางเดิน Says:
    September 22nd, 2026 at 05:45

    … [Trackback]

    […] Info 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/ […]

Comments