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

Jakub Valigura

11/07/2019, 9:47 AM
I am trying to show a Compose Dialog on Button click in a Fragment which uses XML resource as a View. When I call openDialog(…) I get the following exception java.lang.IllegalStateException: Composition requires an active composition context. Is it even possible to mix XML and Compsoe together or was it not implemented yet? Thanks! 🙂
l

Luca Nicoletti

11/07/2019, 9:48 AM
It’s not implemented yet
A
@Composable
function need to be called inside the
setContent
function
👍 3
You can’t call a composable wherever you want
j

Jakub Valigura

11/07/2019, 11:25 AM
Ok, thanks 🙂
r

Ryan Mentley

11/08/2019, 12:28 AM
If you're willing to put up with some awkwardness, there's a
ViewGroup.setContent
extension function, though, that would allow you to do that