B
B
BitNeBolt2020-05-12 13:19:08
Android
BitNeBolt, 2020-05-12 13:19:08

Why doesn't the fragment call onSaveInstanceState?

There is MainActivity inherited from AppCompatActivity. It has bottom navigation. The new Nav is used to switch between fragments. Graph Component.

The problem is this: the fragment doesn't call onSaveInstanceState. And I need to save this state when switching between fragments. There was a discussion of a similar problem here, and someone wrote that this method may not even be called once.

How do I save information from a fragment, since collecting it from the database each time takes time that I don’t want to spend? Are there any alternatives?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmtm, 2020-05-12
@BitNeBolt

use MVVM, ViewModel in relation to the activity,
or stupidly store the state object in the Application

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question