How to get a link to the last popped fragment back?

I add, show and hide fragments. Each time I add / show a fragment, I hide the previous fragment and add a transaction to the stack.

When the user clicks the "Back" button, a fragment appears and I would like to have a link to it .

Why do I need a link? So I could hide it when the user continues the next fragment.

So, how do I get a link to a popup snippet?

EDIT-04-25-2013:

Here's a code to explain how to add a new fragment while hiding the previous one. The question is how to get a link to the last fragment after it jumped out of the back (using the "Back" button)?

FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); fragmentTransaction.hide(lastFragment); fragmentTransaction.add(newFragment); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); lastFragment = newFragment; 
+4
source share
1 answer

I use the created tags for each fragment, keep the tags on the stack, and keep the stack. Thus, I get every fragment, the last one is concrete. See the code here .

+4
source

All Articles