DaleKocian / android-amazing-listview

Automatically exported from code.google.com/p/android-amazing-listview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IllegalStateException while scrolling while updating

GoogleCodeExporter opened this issue · comments

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(P
honeWindow.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(PhoneW
indow.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.jav
a: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.jav
a: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)

Original issue reported on code.google.com by Flynn...@gmail.com on 22 Sep 2012 at 5:26

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

Original comment by Flynn...@gmail.com on 22 Sep 2012 at 5:29

Calling listView.requestLayout instead of notifyDataSetChanged fixes the problem

Original comment by Flynn...@gmail.com on 22 Sep 2012 at 6:33

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

Original comment by noman.iq...@purelogics.net on 11 Dec 2012 at 3:49

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.

Original comment by androidd...@gmail.com on 30 Jan 2013 at 2:25

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.

Original comment by saulpow...@gmail.com on 20 Mar 2013 at 8:30

Confirms removing getAdapter in AmazingListView solves this annoying bug. 

Original comment by goodboy...@gmail.com on 25 May 2013 at 10:44

[deleted comment]
Confirmed removing getAdapter in AmazingListView solves this annoying bug. 

Original comment by goal.tub...@gmail.com on 5 Aug 2013 at 3:25

Confirmed removing getAdapter in AmazingListView solves this annoying bug. 

Original comment by ticap...@gmail.com on 21 Aug 2013 at 8:07

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

Original comment by profa...@gmail.com on 24 Aug 2013 at 3:25

Damn it! I wish i come here earlier!

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Original comment by tsangkin...@gmail.com on 31 Oct 2013 at 8:54

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Original comment by e...@kanunum.com on 3 Dec 2013 at 8:49

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Original comment by j...@thismayhem.com on 6 Dec 2013 at 11:26

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Original comment by stefano....@gmail.com on 9 Dec 2013 at 1:17

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

Original comment by frukt...@gmail.com on 21 Dec 2013 at 5:16

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

Original comment by christof...@gmail.com on 26 Jan 2014 at 5:03

That's the Solution!!!! Gracias xD

Original comment by ssukht...@gmail.com on 16 Mar 2014 at 9:14

Confirmed removing getAdapter in AmazingListView solves this annoying bug.

Original comment by mikeltue...@gmail.com on 4 Jun 2014 at 11:52