N
N
Nick20152015-11-14 21:57:20
Android
Nick2015, 2015-11-14 21:57:20

Fragment rotation implementation?

1-UruQA80WVoyaVQGxbZYE1w.jpeg
How can this be implemented. I have an activity where Fragment A immediately opens (this is a list), after clicking on the list element, the UUID is transferred to fragment B with PagerActivity, the necessary detailing of the list element is opened from it through the adapter (fragment B and C work simultaneously ...). When I have detailing open (Fragment B and C itself), then when you turn the phone it flips to fragment A .... So I can’t figure out how to get around this? could you tell me which direction to go? possibly an example or an article about this problem....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hakito, 2015-11-14
@hakito

When you turn, your activity is re-created, therefore, it returns to its original state. In this case, the state before the rotation can be saved and used during recovery. To do this, use the OnSaveInstanceState method. You override it and write in the Bundle what needs to be saved, and then in OnCreate you restore the saved state

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question