A
A
Alina Mitrokhina2020-05-01 15:32:47
Android
Alina Mitrokhina, 2020-05-01 15:32:47

How exactly does the Jetpack ViewModel save data?

How exactly does the ViewModel work under the hood? When, for example, the user flips the phone? How is data integrity ensured?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2020-05-02
@fursa08

Uses a fragment with setRetainInstance(true). Such a fragment survives a configuration change. Actually, like 5-7 years ago, this mechanism has long existed.
Read more here if you're interested.
It can also be useful to read the source codes, I don’t think they are super complicated there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question