Reputation: 55
11-27 13:24:08.203: ERROR/AndroidRuntime(556): Uncaught handler: thread main exiting due to uncaught exception
11-27 13:24:08.628: ERROR/AndroidRuntime(556): 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(2131165233, class android.widget.ListView) with Adapter(class com.bluepal.android.iConcierge.CustomAdapter)]
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.ListView.layoutChildren(ListView.java:1432)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.AbsListView.onLayout(AbsListView.java:1113)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1108)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.TableRow.onLayout(TableRow.java:121)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.TableLayout.onLayout(TableLayout.java:437)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.onLayout(LinearLayout.java:918)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.onLayout(LinearLayout.java:918)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.ViewRoot.performTraversals(ViewRoot.java:996)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.os.Handler.dispatchMessage(Handler.java:99)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.os.Looper.loop(Looper.java:123)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.app.ActivityThread.main(ActivityThread.java:4363)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at java.lang.reflect.Method.invoke(Method.java:521)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at dalvik.system.NativeStart.main(Native Method)
Upvotes: 4
Views: 7481
Reputation: 5254
As I can't still comment I'll put it as an answer, though it might now solve your problem.
I had the same issue when showing images in a listview that were downloaded in an asynchronous thread and it happened the same when clicking in an item (and by so opening other activity) and immediately pressing the back, thus returning to the ListActivity.
So what I made to (apparently) solve the issue was to hide the list when stopping the activity and showing the list again when going back to it.
@Override
protected void onStop() {
super.onStop();
getListView().setVisibility(View.GONE);
}
@Override
protected void onRestart() {
super.onRestart();
getListView().setVisibility(View.VISIBLE);
}
Quite simple, huh?
Hope it helps you.
Upvotes: 3