I have a program where when one user clicks on a button, it takes them from one fragment to another. The issues is that I want the previous fragment to reappear once the click the back button. Code below:
This is creating the first fragment:
getFragmentManager().beginTransaction().add(R.id.team_fragment_holder, teamFragment).addToBackStack(null).commit();
And this is switching to the second fragment:
setContentView(R.layout.mixed_team_holder);
FragmentManager fragMan = getFragmentManager();
FragmentTransaction fragTrans = fragMan.beginTransaction();
fragTrans.add(R.id.team_1,team1);
fragTrans.add(R.id.team_2, team2);
fragTrans.commit();
The problem right now is that when i hit the back button, a blank page appears (i assume is the (R.id.team_fragment_holder). Any idea to make the first fragment reappear along with all the information on it?
Note: all fragments extends listfragment.
Thanks in advance.