-2

I have two activities.One activity has listview and second activity has gridview..one i click from listview activity the next activity will open safly but when i press back button from emulator listacitivity will show but when i click on listactivity again it give me forceclose option and my app crash...Logcat error is there..

01-30 05:32:24.748: E/AndroidRuntime(998): FATAL EXCEPTION: main
01-30 05:32:24.748: E/AndroidRuntime(998): 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(16908298, class android.widget.ListView) with Adapter(class android.widget.ArrayAdapter)]
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.widget.ListView.layoutChildren(ListView.java:1538)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.widget.AbsListView.onTouchEvent(AbsListView.java:3513)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.view.View.dispatchTouchEvent(View.java:7127)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2170)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1905)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
01-30 05:32:24.748: E/AndroidRuntime(998):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1925)
01-30 05:32:24.748: E/AndroidRuntime(998):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1379)
01-30 05:32:24.748: E/AndroidRuntime(998):  at android.app.Activity.dispatchTouchEvent(Activity.java:2396)
01-30 05:32:24.748: E/AndroidRuntime(998):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1873)
user1722376
  • 107
  • 3
  • 10

1 Answers1

0

Without the code, It is quite difficult to say what might be wrong. but the most possible solution I can think of is,

I think you are performing some computations in the second Activity, which are modifying the contents that are being displayed in the List Activity.

When you open second activity, just finish() the first Activity and on pressing back button(Override the onBackPressed()) from the second Activity create a new Intent to open the first activity.

Let me know if you want assistance on how to override the onBackPressed() function.

Sahil Mahajan Mj
  • 11,033
  • 8
  • 53
  • 100