-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Description: I have list of images displayed in Carousel. Once navigated to a (settings) fragment, and comming back to main Carousel, my app crashes. When I looked at stacktrace I got: https://bin.utwitch.net/zodineqadi.apache
after onResume() callback, app crashes.
I was hopelessly searching on how to use SavedStateHandle to fix this and found:
(I absolutely do not understand this code, but it was odd to my eyes)

Expected behavior: Carousel page should resume and show images from where it was before navigation action.
Source code: fragment_carousel.xml, CarouselFragment.kt, nav_graph.xml
but remove these two to reproduce the issue
app:launchSingleTop="true"
app:popUpTo="@id/nav_graph"Minimal sample app repro: https://github.com/nijuyonkadesu/SAO/tree/settings
Android API version: 33
Material Library version:
recycler-view = "1.3.1"
m3 = "1.10.0"
nav = "2.7.4"
Device: Redmi Note 11 [MIUI - Android 12], Redmi Note 9 Pro [Android 13 - Custom ROM]