Export to GitHub

android-amazing-listview - issue #3

IllegalStateException while scrolling while updating


Posted on Sep 22, 2012 by Happy Ox

What steps will reproduce the problem? 1. Use demo app, pagination demo. Wait for initial update 2. scroll to bottom until showing loading item 3. scroll up/down small amounts while waiting for update

What is the expected output? What do you see instead? Expected to see list update normally, instead get illegalStateException

What version of the product are you using? On what operating system? latest, android 4.1.1

Please provide any additional information below.

09-22 18:06:24.890: E/InputEventReceiver(10594): Exception dispatching input event. 09-22 18:06:24.905: E/AndroidRuntime(10594): FATAL EXCEPTION: main 09-22 18:06:24.905: E/AndroidRuntime(10594): 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(2131034170, class com.foound.widget.AmazingListView) with Adapter(class android.widget.HeaderViewListAdapter)] 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.widget.ListView.layoutChildren(ListView.java:1538) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3456) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.View.dispatchTouchEvent(View.java:7127) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2170) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1905) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 09-22 18:06:24.905: E/AndroidRuntime(10594): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1925) 09-22 18:06:24.905: E/AndroidRuntime(10594): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1379) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.app.Activity.dispatchTouchEvent(Activity.java:2396) 09-22 18:06:24.905: E/AndroidRuntime(10594): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1873) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.View.dispatchPointerEvent(View.java:7307) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3172) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3117) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4153) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4132) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4224) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4203) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4243) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.Choreographer.doCallbacks(Choreographer.java:555) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.Choreographer.doFrame(Choreographer.java:523) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.os.Handler.handleCallback(Handler.java:615) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.os.Handler.dispatchMessage(Handler.java:92) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.os.Looper.loop(Looper.java:137) 09-22 18:06:24.905: E/AndroidRuntime(10594): at android.app.ActivityThread.main(ActivityThread.java:4931) 09-22 18:06:24.905: E/AndroidRuntime(10594): at java.lang.reflect.Method.invokeNative(Native Method) 09-22 18:06:24.905: E/AndroidRuntime(10594): at java.lang.reflect.Method.invoke(Method.java:511) 09-22 18:06:24.905: E/AndroidRuntime(10594): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 09-22 18:06:24.905: E/AndroidRuntime(10594): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558) 09-22 18:06:24.905: E/AndroidRuntime(10594): at dalvik.system.NativeStart.main(Native Method)

Comment #1

Posted on Sep 22, 2012 by Happy Ox

Wrapping the adding/updating code in PostExecute in runOnUiThread has no effect

Comment #2

Posted on Sep 22, 2012 by Happy Ox

Calling listView.requestLayout instead of notifyDataSetChanged fixes the problem

Comment #3

Posted on Dec 11, 2012 by Grumpy Bird

listView.requestLayout this solve the problem but still y its not working for notifyDataSetChanged .

Comment #4

Posted on Jan 30, 2013 by Happy Giraffe

I am experiencing the same issue, and even forcing listView.requestLayout resolves the issue. I'm testing on a Nexus 7 tablet with Android 4.2. If I scroll up and down while my AsyncTask is grabbing the next chunk of data, the app crashes as soon as the data adapter is updated with the new elements. The adapter update is called from my AsyncTask.onPostExecute, and I am calling notifyDatasetChanged() right after the data is updated. I have removed the loading view so the app won't crash, and replaced it with a loading view drawn on top of the listview instead. It would be good to get a resolution for this though. The footer view loading indicator is nicer than my solution.

Comment #5

Posted on Mar 20, 2013 by Quick Rhino

I think this issues stems from the fact that getAdapter is returning the AmazingAdapter instead of the wrapped HeaderListViewAdapter causing a difference in count at times. I simply removed the getAdapter method from AmazingListView and haven't got the exception since.

Comment #6

Posted on May 25, 2013 by Happy Dog

Confirms removing getAdapter in AmazingListView solves this annoying bug.

Comment #7

Posted on Jun 25, 2013 by Quick Rabbit

Comment deleted

Comment #8

Posted on Aug 5, 2013 by Happy Lion

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Comment #9

Posted on Aug 21, 2013 by Massive Giraffe

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Comment #10

Posted on Aug 24, 2013 by Quick Lion

Confirmed removing getAdapter in AmazingListView solves this annoying bug. =)

Comment #11

Posted on Oct 31, 2013 by Quick Wombat

Damn it! I wish i come here earlier!

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Comment #12

Posted on Dec 3, 2013 by Quick Lion

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Comment #13

Posted on Dec 6, 2013 by Helpful Bird

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Comment #14

Posted on Dec 9, 2013 by Quick Camel

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Comment #15

Posted on Dec 21, 2013 by Grumpy Wombat

Thanks a lost. I spent hours to get it works and finally found this blessing solution to fix issue.

Comment #16

Posted on Jan 26, 2014 by Quick Lion

That s the solution!!!!!!!!!! Cheeeeerss!!

Comment #17

Posted on Mar 16, 2014 by Helpful Rhino

That's the Solution!!!! Gracias xD

Comment #18

Posted on Jun 4, 2014 by Massive Ox

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Status: New

Labels:
Type-Defect Priority-Medium