Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException #46

Closed
lauraoran opened this issue Jul 25, 2014 · 4 comments
Closed

java.lang.IllegalStateException #46

lauraoran opened this issue Jul 25, 2014 · 4 comments

Comments

@lauraoran
Copy link

Hi,
I have the following error:

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(2131296374, class eu.erikw.PullToRefreshListView) with Adapter(class android.widget.HeaderViewListAdapter)]
at android.widget.ListView.layoutChildren(ListView.java:1538)
at android.widget.AbsListView.onTouchEvent(AbsListView.java:3702)
at eu.erikw.PullToRefreshListView.onTouchEvent(PullToRefreshListView.java:350)
at android.view.View.dispatchTouchEvent(View.java:7149)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1908)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2179)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1922)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2179)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1922)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2179)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1922)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2179)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1922)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2179)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1922)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2198)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1574)
at android.app.Activity.dispatchTouchEvent(Activity.java:2582)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2147)
at android.view.View.dispatchPointerEvent(View.java:7329)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3202)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3144)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4183)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4162)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4271)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:125)
at android.os.Looper.loop(Looper.java:124)
at android.app.ActivityThread.main(ActivityThread.java:4941)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
at dalvik.system.NativeStart.main(Native Method)

How can I solve that? I've just implemented the PullToRefreshView like in the sample code.

Thanks

@erikwt
Copy link
Owner

erikwt commented Jul 31, 2014

Hi,

The first line says it all, really: 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.

You can for example use the runOnUiThread(...) method to post a runnable to the UI thread where you modify the content of the adapter. It has nothing to do with the PullToRefresh implementation by the way, it's the ListView itself.

@erikwt erikwt closed this as completed Jul 31, 2014
@lauraoran
Copy link
Author

Hi,
I modify the content on a runOnUiThread, but still having the issue.

@erikwt
Copy link
Owner

erikwt commented Jul 31, 2014

Do you call notifyDataSetChanged() on the adapter?

On Thursday, July 31, 2014, lauraoran notifications@github.com wrote:

Hi,
I modify the content on a runOnUiThread, but still having the issue.


Reply to this email directly or view it on GitHub
#46 (comment)
.

Erik Wallentinsen

Technical Director

erik.wallentinsen@infostrada.com

06 52417107

Infostrada Interactive, Meeuwenlaan 98-100, Amsterdam

020 6364870
www.infostrada.com

@lauraoran
Copy link
Author

Yes, inside the runOnUiThread I call the adapter notifyDataSetChanged().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants