Relative Content

Tag Archive for androidandroid-jetpack-compose

Jetpack Compose launcher app launching animation

I am developing a launcher in jetpack compose and when I try to launch app it has default horizontal slide in animation which I’d like to change. I tried makeCustomAnimation(this@Activity, android.R.anim.fade_in, android.R.anim.fade_out), but it has no difference and ActivityOptions.makeScaleUpAnimation requires a view which I have no idea how to provide since this is a jetpack compose.
What are my options to have semi-okayish animation where Icon scales up as supposed to and not just blank screen for 3 seconds?

How to use ViewModel with Android Compose?

I use a Composable function that contains a lot of states and methods, so I encapsulate them into a ViewModel. I expect this ViewModel to automatically initialize every time the Composable function is displayed, and to automatically destroy them when the Composable function is destroyed. But in reality, the ViewModel instance is retained in memory, so every time the Composable function is re entered, old data is still used. I have to define an additional init method to reinitialize, but there should be a better way.

How to use ViewModel with Android Compose?

I use a Composable function that contains a lot of states and methods, so I encapsulate them into a ViewModel. I expect this ViewModel to automatically initialize every time the Composable function is displayed, and to automatically destroy them when the Composable function is destroyed. But in reality, the ViewModel instance is retained in memory, so every time the Composable function is re entered, old data is still used. I have to define an additional init method to reinitialize, but there should be a better way.

How to use ViewModel with Android Compose?

I use a Composable function that contains a lot of states and methods, so I encapsulate them into a ViewModel. I expect this ViewModel to automatically initialize every time the Composable function is displayed, and to automatically destroy them when the Composable function is destroyed. But in reality, the ViewModel instance is retained in memory, so every time the Composable function is re entered, old data is still used. I have to define an additional init method to reinitialize, but there should be a better way.