I've implemented something like the below picture:
I have some Tabs and every tab may have some buttons which load some different fragments. In this situation, in Tab 1, Button 1 loads Fragment 1, and Button 2 loads Fragment 2 and each time the Fragments will be re-created. but I want Buttons to load Fragments just once and avoid re-creating next times.
Button 1 current onClick:
FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.container_root, FragmentOne.newInstance(),"Frag1");
transaction.commit();
How can I save fragments states to avoid reloading every time?
EDIT
The Tab 1 and Tab 2 Fragments are inside a ViewPager so I could not use ViewPager for Fragment 1 and Fragment 2.
