Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8805873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:58:35+00:00 2026-06-14T01:58:35+00:00

I recieve exception while manipulating with navigation forward and backward from FragmentActivity , containing

  • 0

I recieve exception while manipulating with navigation forward and backward from FragmentActivity, containing ListView with data loaded from custom Loader (it is loading from local sqlite database), and do not know how to deal with it…

Here is a stacktrace:

Uncaught exception: Unable to destroy activity {com.snyer.bestprice/com.snyer.bestprice.PriceTracerActivity}: java.lang.RuntimeException: Unable to destroy activity {com.snyer.bestprice/com.snyer.bestprice.CartFragmentActivity}: java.util.ConcurrentModificationException
java.lang.RuntimeException: Unable to destroy activity {com.snyer.bestprice/com.snyer.bestprice.PriceTracerActivity}: java.lang.RuntimeException: Unable to destroy activity {com.snyer.bestprice/com.snyer.bestprice.CartFragmentActivity}: java.util.ConcurrentModificationException
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3106)
    at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3171)
    at android.app.ActivityThread.access$2100(ActivityThread.java:132)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1071)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:150)
    at android.app.ActivityThread.main(ActivityThread.java:4293)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Unable to destroy activity {com.snyer.bestprice/com.snyer.bestprice.CartFragmentActivity}: java.util.ConcurrentModificationException
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3106)
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:2994)
    at android.app.LocalActivityManager.dispatchDestroy(LocalActivityManager.java:625)
    at android.app.ActivityGroup.onDestroy(ActivityGroup.java:85)
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3088)
    ... 11 more
Caused by: java.util.ConcurrentModificationException
    at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:576)
    at android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java:42)
    at android.widget.BaseAdapter.notifyDataSetInvalidated(BaseAdapter.java:54)
    at android.support.v4.widget.CursorAdapter.swapCursor(CursorAdapter.java:352)
    at com.snyer.bestprice.CartFragmentActivity.onLoaderReset(CartFragmentActivity.java:412)
    at android.support.v4.app.LoaderManagerImpl$LoaderInfo.destroy(LoaderManager.java:337)
    at android.support.v4.app.LoaderManagerImpl.doDestroy(LoaderManager.java:773)
    at android.support.v4.app.FragmentActivity.onDestroy(FragmentActivity.java:318)
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3088)
    ... 15 more

Exceptions occures at line mCartCursorAdapter.swapCursor(null); of this code-fragment (CartFragmentActivity.java:412):

public void onLoaderReset(Loader<Cursor> loader) {
    switch (loader.getId()) {
    case LOADER_CART_LIST_ID:
        mCartListCursorAdapter.swapCursor(null);
        break;

    case LOADER_CART_CONTENTS_ID:
        mCartCursorAdapter.swapCursor(null);
        break;
    }
}

What can be done here to remove this exception?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:58:37+00:00Added an answer on June 14, 2026 at 1:58 am

    The sdk source gives a good hint as a comment:

    In Android 4.0.4 it is:

    public void notifyInvalidated() {
        synchronized(mObservers) {
            for (int i = mObservers.size() - 1; i >= 0; i--) {
                mObservers.get(i).onInvalidated();
            }
        }
    }
    

    In earlier versions it was:

     synchronized (mObservers) {
            for (DataSetObserver observer : mObservers) {
                observer.onInvalidated();
            }
        }
    

    The 4.0.4 source has the following comment regarding the same changes in onChange method:

    // since onChanged() is implemented by the app, it could do anything, including
    // removing itself from {@link mObservers} - and that could cause problems if
    // an iterator is used on the ArrayList {@link mObservers}.
    // to avoid such problems, just march thru the list in the reverse order.
    

    I am not aware of manipulating the ArrayList of observers in any illegal way though. Since this is solved in later APIs and I can’t think of any impact on my App I think I am simply going to ignore the exception with a log entry or similar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got class (subclassed from QThread), that recieve data from server at many sockets
I am building a client that can recieve information from the server and from
I need a server to send and recieve XMPP messages from Android clients running
I've been trying to Base64 encode image data from the user (in this case
I am learning WCF and right now I am getting one exception while running
I receive the following exception while attempting to log an error using Enterprise Library
I have a weird problem. While running my Android application, I receive Exception: java.lang.ClassCastException:
I receive the following Exception while trying to send an email (using Seam) Caused
I've been trying this for a while, and I want multiple clients to recieve
I've created a custom exception for a very specific problem that can go wrong.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.