Kebbin
02/26/2022, 11:08 AMText
object's contents in a @Composable
to update when a global String variable changes.
I have a global String var dataIn = ""
that regularly fills with characters like data += char
in one function, but I can't get its value change to recompose the displayed Text
in the other function!
I thought it should be doable using var dataDisplay: String = remember { mutableStateOf(dataIn) }
and Text(text = dataDisplay)
but it won't update the text display every time a new char is added to the dataIn
variable.
Thanks again!Michael Paus
02/26/2022, 11:46 AMdataDisplay
is initialised. That’s what remember
is made for.Kebbin
02/26/2022, 11:46 AMMichael Paus
02/26/2022, 11:47 AMMichael Paus
02/26/2022, 11:48 AMKebbin
02/26/2022, 11:49 AMKebbin
02/26/2022, 11:49 AMKebbin
02/26/2022, 11:50 AMZach Klippenstein (he/him) [MOD]
03/01/2022, 4:27 PMZach Klippenstein (he/him) [MOD]
03/01/2022, 4:28 PMZach Klippenstein (he/him) [MOD]
03/01/2022, 4:29 PMKebbin
03/02/2022, 1:00 AM