I have an activity that has a container. And i have two fragments that I'm replacing into this container. The fragments are fragmentList and fragmentDetail
First time I'm adding the list fragment into the container
MainActivity OnCreate
if (savedInstanceState == null) {
ListFragment listFragment = new ListFragment();
ft.add(R.id.fragment_container, listFragment, "LIST");
ft.commit();
}
When the user clicks on the list, I replace the container with the detail fragment
ActionButton
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, detailFragment);
fragmentTransaction.commit();
http://www.vogella.com/tutorials/Android/images/xfragmentsusage10.png.pagespeed.ic.MkyF4ZO5Hr.png
The problem came when I restart the activity. How I can know if I need to request the list data again, or if the detail fragment are shown? Because in my onResume method both fragments are null.