Q:

Can the views of a fragment be modified when the fragment is in backstack? 

I have two fragments which share the same spot on a activity.  When activity starts fragA is displayed.  When you click a button from fragA it gets pushed to backstack and replaced by fragB. When a button from fragB is pressed the fragB is destroyed and fragA is poped from the backstack but it should also change some views based on what button from fragB was pressed (set the text for a textview for example).  I used interfaces for fragment-activity communication.  Everything goes well but the views from fragA don't want to change.  I think I'm trying to change them while the fragment is in backstack. 
@Override
    public void onFragBClick(Bundle bundle) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        fragA = (FragA) fragmentManager.findFragmentByTag(TAG_FRAG_A);
        if (fragA ! = null) {
            fragmentManager.popBackStack(TAG_FRAG_A_BACKSTACK, 
                    FragmentManager. POP_BACK_STACK_INCLUSIVE);
            fragA.onFragBSignalReceived(bundle);
        }

    }

This is the method that handles communication.  Everything seems fine in logs, onFragBSignalReceived gets called, but I can't change the state of fragA's views in it.  My guess is that when it gets called fragA is still on the backstack and that's why views are not updated.  In that case how can I achieve this behavior in some other way?  

A:

You might want to use popBackStackImmediate() instead of popBackStack().  popBackStackImmediate() will perform the operation inside the method, whereas popBackStack() will queue the action and perform it later on. 