Hi everyone! Sorry if this was already discussed, ...
# compose
d
Hi everyone! Sorry if this was already discussed, I'm new here. I have a custom android view and I'm using
AndroidView
to compose it. Now I need to access that view when the user presses a button to get its state. To simplify, I have an EditText and I need its content when the user presses 'Next'. How Can I access the state of that view? I know I could build it from scratch using compose, but I have a lot of custom views and plan to migrate them progressively.
t
going off of this, have you tried keeping a
val enteredText = remember { mutableStateOf("") }
or something at the Compose level, and then using the `EditText`’s listener to keep that value up to date? essentially, you’d be pseudo hoisting the state from within the android view, up to the Compose level. this is probably the best approach for most such cases because you’re not leaning into the imperative-ness of the android view
d
thanks Tash, I totally overlooked that and it worked 🙂
🙌🏼 1