Clear stack without onresume

I got activity a. then I put b in the backsatck and displayed it;
I want to call c in a way that doesn't get called again, however I want pop B from BackStack to return from C. I want it to return to A.
Here is the scenario:
A-> B
C Called: A-> C
With closed by pressing: return back to A
However, when I pop B from the backstack (to replace it with C), a fragment of A onResume is called and does not allow B to display normally. I also used:

fragmentManager.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE);`

However, this does not resolve the issue. Here is the code for switchFragments:

fragmentManager.popBackStack(null,
                FragmentManager.POP_BACK_STACK_INCLUSIVE);

        if (fragment != null) {
            FragmentTransaction transaction = fragmentManager
                    .beginTransaction();
            transaction.replace(R.id.content_frame, fragment, tag);
            // Only ArticlDetailFragment is added to the back stack.
            if (!(fragment instanceof HomeFragment)
            /* && isItNotification == false */) {
                if (debug == 1)
                    Log.v("DEBUG_TAG", "MainAcitivy switchContent2");

                transaction.addToBackStack(tag);
            }
            transaction.commit();
            contentFragment = fragment;
        }

HomeFragment is what is called A.

+4
source share
1

backstack:

getFragmentManager().beginTransaction().add(R.id.content_frame, fragment).addToBackStack(null).commit();
-1

All Articles