Reputation: 109
Here I little confuse with Fragments,
I create a one Activity-'A'. Add Fragment-'X' in Activity. Replace Fragment-'Y' in place of Fragment-'X' Now i want to open Fragment-'X' with saved state in Activity-'A'.
Please help me,
Thanks in Advance.
Upvotes: 0
Views: 63
Reputation: 5707
Use in onBackPressed()
FragmentManager fm = getActivity().getSupportFragmentManager();
fm.popBackStack();
and for more details check link!!!
Upvotes: 2
Reputation: 436
To open fragment x from fragment y use the code....
getActivity().getSupportFragmentManager().popBackStack();
Upvotes: 1