How To Return To Previous Fragment Activity
Three fragment activities: MainFragmentActivity, Reports and ReportsType. Reports is calling ReportsType. There is a back button in ReportsType to go back with the following code:
Solution 1:
There's no concept of calling finish()
on Fragment
. Instead, you should keep stack of fragments when performing transactions. For example:
ft.addToBackStack(null); // ft is FragmentTransaction
So, when you press back-key, the current activity (which holds multiple fragments) will load previous fragment rather than finishing itself.
Post a Comment for "How To Return To Previous Fragment Activity"