Look, you can use the very life cycle of fragment like the onActivityCreated. Usually this kind of situation of losing data and having to recover happens, for example, when the screen is rotated. In this case, to record a route, you basically need a array coordinate right?! So come on, see the code below and adapt it to your needs:
public class ExampleFragment extends Fragment {
private List<String> myData;
@Override
public void onSaveInstanceState(final Bundle outState) {
super.onSaveInstanceState(outState);
outState.putSerializable("list", (Serializable) myData);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState != null) {
myData = (List<String>) savedInstanceState.getSerializable("list");
} else {
if (myData != null) {
} else {
myData = computeData();
}
}
}
}
From one observed in these gifs regarding the moment he saves and the moment of restoration of one Fragment:
Saving and Restoring State

I found this article and found it very interesting. Worth reading.
How you’re doing the TAB toggle?
– ramaral