How to save the state of fragment when calling replace?

I have a task of creating a preview of the data entered.
To solve this problem, I call a new fragment from current fragment, with the method replace. From the preview, the user goes "back" button ("Back")(for now, but this feature should remain).
As it turned out when such actions onSaveInstanceState is not called for the current fragment, the result is stored only the data entered in the fields with id.

Tell me how to save the state of fragment in this case?

UP. For the current fragment I call addToBackStack(null);
July 4th 19 at 23:58
1 answer
July 5th 19 at 00:00
In my opinion here at all replace do not use. Do you need to add for the snippet preview it will appear on top of the current, and the current status will not change.
Method onSaveInstanceState is called when the configuration changes when you delete a fragment by calling replace any configuration changes does not occur, and therefore the state is not saved and not restored.

Find more questions by tags Android