When i move from Fargment A to another Fragment B and come back to the Fragment A, I do not want to create or inflate fragment A view again. How to maintain and restore the state of Fragment A.
Below is the code, how i am moving from fragment A to Fragment B.
FragmentManager fragmentManager=getActivity().getSupportFragmentManager();
FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction();
FragmentB fragmentB=new FragmentB();
fragmentTransaction.replace(R.id.frameLayoutmainActivity, fragmentB);
fragmentTransaction.addToBackStack("previous");
fragmentTransaction.commit();
and when come back to fragment A, on the back button click....
FragmentManager fm = getActivity().getSupportFragmentManager();
fm.popBackStack();
but the problem is onCreateView() always called and view inflates again.I do not want to inflate view again.