Android - how to prevent a fragment from losing focus?

Short version: how to prevent a fragment from losing focus?

Long version: I overlay 3 fragments on top of an existing action using a fragment transaction.

overlaying fragments

Here you can see how it looks. Fragment C is the source fragment displayed as part of the activity. After a certain event, I make a transaction with the addition of new fragments:

ContainerFragment containerFragment = new ContainerFragment();
FragmentA aFragment = new FragmentA();
FragmentB bFragment = new FragmentB();
bFragment.setListener(listener);

FragmentTransaction transaction = manager.beginTransaction();
transaction.add(R.id.c_fragment, containerFragment, TAG_CONTAINER);

// added within the layout used by containerFragment

transaction.add(R.id.a_fragment, aFragment, TAG_A);
transaction.add(R.id.b_fragment, bFragment, TAG_B);

transaction.addToBackStack(TRANSACTION_NAME);
transaction.commit();

Note. I do not use a separate action to trigger fragments A and B because I do not want to pause the initial action.

, . , Dpad, "", A - C ( B ). A?

:)

+5

All Articles