I ran into the rotation bug where my app resets every time I turn the phone. From what I understand Android recreates the Activity on rotation so normal variables lose their values. I’ve read that ViewModel survives rotation so I’ve been putting my screen state there. I also found rememberSaveable, which apparently survives rotation and even the app getting killed in the background. Is that right? Also what do you actually do in real projects? Do you keep almost everything in the ViewModel or do you use rememberSaveable and SavedStateHandle for some things too? Would love to hear what works for you.

submitted by /u/dark_devil307
[link] [comments]