I am currently building an application for Android (14 <= SDK <= 21) by using one ActionBarActivity
and more Fragments
, such as ListFra
Try this (Note add not replace for fragmentA, and addToBackStack() for fragmentB)
StopItemFragment list = StopItemFragment.newInstance(null); //A - extends ListFragment
fragmentManager.beginTransaction()
.add(R.id.content_frame, list)
.commit();
and
StopFragment fragment = StopFragment.newInstance(null, null); //B - extends Fragment
...
fragmentManager.beginTransaction()
.replace(R.id.content_frame, fragment)
.addToBackStack("FragmentB")
.commit();