I need to override a method and return a View inside a Composable function. Is there a way to get View out of another Composable function?
I need something like this where getInfoContents() will return a view just with a Text. The code below will not compile obviously. I can always inflate an XML layout but want to return a View that is generated by a Composable function.
AndroidView({ mapView }) {
CoroutineScope(Dispatchers.Main).launch {
val map = mapView.awaitMap()
map.setInfoWindowAdapter(object : GoogleMap.InfoWindowAdapter {
override fun getInfoContents(p0: Marker): View? {
return AndroidView(factory = {
Text(text = "Hello")
}).toView() ... or something like this
}
override fun getInfoWindow(p0: Marker): View? {
TODO("Not yet implemented")
}
})
}
}