I have 4 button to replace fragment in activity [fragment A , fragment B , fragment C , fragment D] and then I replace fragment A to activity and I change value in fragment A after that I replace fragment B to fragment A and replace fragment C to fragment B . But I want to replace fragment A to fragment C . How to save state in fragment A.
Code when I commit fragment
  private void beginFragmentTransaction(BaseFragment fragment) {
    String tag = fragment.getClass().getName();
    currentFragmentTag = tag;
    boolean fragmentPopped = getChildFragmentManager().popBackStackImmediate(tag, 0);
    if (!fragmentPopped) {
        getChildFragmentManager().beginTransaction()
                .replace(R.id.container, fragment, tag)
                .addToBackStack(tag)
                .commit();
    }
}
Diagram to replace
fragment A -------> fragment B
fragment B -------> fragment C
fragment C -------> fragment A
PS. I don't want to use back button to back to fragment A , I want to replace fragment A and restore data in the first commit.
 
     
     
     
    