When adding activities to the stack, I can do something like this suggests: How to bring an activity to foreground (top of stack)?
However, I have a Navigation Drawer that uses fragments. I add these fragments to my back stack via the below code:
FragmentTransaction transaction = activity.getFragmentManager().beginTransaction();
transaction.replace(R.id.main_fragment, new EntryFragment());
transaction.addToBackStack(activity.mTitle.toString());
transaction.commit();
The problem is, I now need to take a fragment that is already part of the back stack and bring it to the top, dropping all fragments currently above it out of the stack. Essentially what FLAG_ACTIVITY_REORDER_TO_FRONT
and FLAG_ACTIVITY_CLEAR_TOP
flags would do when using activities.
How do I accomplish this with fragments?