When using a ComposeView in an activity, is there...
# compose
b
When using a ComposeView in an activity, is there a way to detect changes to activity variables?
Copy code
private val myState: State = State(value = 0)

someListener.onChange { value -> myState.value = value}

binding.composeView.setContent {
  MyComposeView(
    state = myState.value   // Not recomposing on value changed
  )
}
s
are you using
mutableStateOf
? what kind of state is
myState
?
b
State is a simple POJO. Also tried with mutableState in activity w/o luck.
s
you need to use
mutableStateOf
in this case and then it should work regular objects are not observed by composition, while states are