# compose

Can Korkmaz

08/25/2022, 9:12 AM
Hello, in Androidview does setting a layout parameter in previous recompositions with update block stay intact even if the update block changes, or does it default to factory settings. Also assuming I insert an animation inside update block,
Copy code
imageView.animateByResource(R.anim.shrink_animation) {
would that default to initial value at every compositon. Like adding a lifecycleEventObserver in update state, it would be added many times since it is added every recomposition. I pass update block as lambda parameter by the way. If the way I understand the update block mechanics is correct, then I should wrap updates that I want to execute only once in an Event, and use with getIfNotHandled(). Or with additional control blocks.
Example of the way of use I'm proposing:
Copy code
val cameraUpdate = remember<(CameraView)->Unit>{ // this goes inside AndroidView //update block
        frameProcessorEvent.value.getIfNotHandled()?.let {
Now that I experimented (and logged) with it a bit, I probably dont need to use an Event, as it appears to only re-run the function if the passed state changes, or in my case lambda argumetn.