1

Scenario: fragment is visible, user minimises the app and brings it back from background.

Why onCreateView onCreate is not being called and it jumps straight to calling onStart?

When is onCreate onCreateView called? How to restore fragment data if it jumps straight to onStart?

Marius
  • 243
  • 1
  • 9

1 Answers1

0

as stated here: https://developer.android.com/guide/components/fragments#Lifecycle

"The fragment isn't visible. Either the host activity has been stopped or the fragment has been removed from the activity but added to the back stack. A stopped fragment is still alive (all state and member information is retained by the system). However, it is no longer visible to the user and is killed if the activity is killed."

And you can save the data using the OnSaveInstanceState(Bundle) on the onStart() method

Jymyu
  • 16
  • 3