In the main activity `ActivityA` I replace `FragmentA` by fragment `FragmentB`. From `FragmentB` the user can start a new activity `ActivityB`. By hitting the back button in `ActivityB`, `ActivityA` is displayed showing `FragmentA`. I was expecting to see `FragmentB` with its last state. Do I have to save the state of the previous activities separately to provide this behaviour?

```
ActivityA(FragmentA) -> ActivityA(FragmentB) -> ActivityB 
BACK
ActivityA(FragmentB)

```

In the main activity I set the current fragment using:

```
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
               .replace(R.id.a_main_frame_content, new FragmentB())
               .addToBackStack(null)
               .commit();

```

From the fragment I start a new activity using:

```
Intent intent = new Intent(getActivity(), ActivityB.class);
getActivity().startActivity(intent);

```

`ActivityA` is set as parent activity for `ActivityB` to provide proper navigation.

**[UPDTATE]** It looks like the problem lies in the different behaviour of navigating back and navigating up. If I navigate back, the activity is displayed in its last state while navigating up forces the activity to recreate.