YASAN
10/27/2021, 10:25 AMView
on my Composable which I need to init
to show. The init
is a heavy process so I really want to avoid doing it when its not needed.YASAN
10/27/2021, 10:25 AMYASAN
10/27/2021, 10:26 AMYASAN
10/27/2021, 10:28 AMDisposableEffect(key1 = youTubePlayerViewModel) {
youTubePlayerViewMutable.value = YouTubePlayerView(context)
onDispose {
youTubePlayerViewMutable.value?.release()
}
}
I also have this code to call the init
function which is outside of `onDispose`:
LaunchedEffect(video.id) {
youTubePlayerViewMutable.value?.let {
it.initialize()
}
}
Alex
10/27/2021, 10:28 AMAndroidView
?YASAN
10/27/2021, 10:29 AMonDispose
is called even when I am navigating to a new screen and the screen is on backstackYASAN
10/27/2021, 10:29 AMYASAN
10/27/2021, 10:32 AMAndroidView
to show a view and there isnt any other options afaik. The question is how to avoid reinitializing the view when its unneeded. My screen is basically being resumed but my view is being reinitialized which is an unwanted behavior for me.Alex
10/27/2021, 10:32 AMYASAN
10/27/2021, 10:41 AM