RestoreInstanceState Android Fragments

0

I'm making an app where the camera can be used. The thing is that I found a tutorial, but use Activity and I'm using fragments. The point is that everything works perfectly, but I realized that the onRestoreInstanceState method does not have the fragments. Is there something similar? The code in activity is as follows:

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString("file_path", mPath);
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);

    mPath = savedInstanceState.getString("file_path");
}

How is it done in fragments?

    
asked by Javier Aguilar 13.11.2017 в 20:07
source

0 answers