https://kotlinlang.org logo
#compose
Title
# compose
m

Mario Andhika

11/21/2023, 3:16 AM
Hello everyone. I need to integrate a third-party view, that actually is more than just a view, using
AndroidView
? As in, basically view-wise it’s a
WebView
, but it also has methods I can call to go to specific pages, for which I want to have
Button
for it. The pages aren’t static, and need to be fed data from a web API. How do I structure it so I can call the methods of this
AndroidView
from my compose
Button
?
c

Chris Fillmore

11/21/2023, 3:31 AM
You could pass a Flow down to this level of this custom View, and collect events from the Flow to trigger navigation and such
Or, pass the custom View to a higher level, and just call those methods directly. Careful to make sure you are not retaining references to old Views if they are disposed
2 Views