I am developing an app with Jetpack Compose. In my project, I have to add a custom map view that uses a GLSurfaceView
. When creating that view, it takes some time to initialize everything. Now when I navigate to another screen and back to the map screen, the setup process is performed again for the GLSurfaceView
which leads to the animation being stuck. I know that there is remember
, but it is only helpful for recompositions, not when navigating between screens. And saving a view instance in a viewmodel seems wrong to me.
Is there any way of keeping the initialized instance of that GLSurfaceView
during the lofetime of the app?
(My composable looks more or less like this)