Fragment Already active.....some devices

I have an app in beta testing that has emotional issues. The app has an activity with several fragments. I am passing parameters using the fragment arguments. The project builds OK, it runs OK in the emulator. I have it in closed testing. it runs correctly on some devices but on an Asus tablet in particularly it kacks and the debugger gives me a Fragment already active when the code wants to set the bundle to the Argument. I am at a loss why it runs on some devices and not others. As I said I get no build errors


  • GlennErlerGlennErler USMember ✭✭

    More info - it runs OK on Android 8.1, I am Targeting 7.0 but it crashes with thee illegalstate exception on it.

  • GlennErlerGlennErler USMember ✭✭

    This code runs fine on Android 8 or above. Kacks with a Fragment is already active exception on lower.

    Bundle nBundle = new Bundle();
    nBundle.PutString("CustName", customer);
    this.Arguments = nBundle;

    Missed something in the release notes but cannot find what that might be
    Thx for reading

  • GlennErlerGlennErler USMember ✭✭

    Got things working.
    In the main activity I set an empty bundle on the fragment before the transaction
    frag.Arguments = new Bundle();

    and then in the fragment event I did

    Things seem to work fine on Android >=7;

    Not sure if I should have done this in the first place or if there is a more correct way

Sign In or Register to comment.