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

andylamax

06/29/2020, 10:48 PM
What is the difference between these two?
Copy code
// 1st
(view as FrameLayout).setContent(Recomposer.current()) {

}

//2nd        
(view as FrameLayout).setViewContent {

}
z

Zach Klippenstein (he/him) [MOD]

06/29/2020, 10:49 PM
The second one will probably crash, or at least won’t do what you want, and i think it’s going to be removed eventually.
l

Leland Richardson [G]

06/29/2020, 10:53 PM
setContent is probably what you want
eventually we are likely to remove
ViewGroup.setContent
and change it to
AndroidComposeView.setContent
(meaning you will need to create a compose view specifically to kick off a composition, versus using any view at all)
and
ViewGroup.setViewContent
will also likely go away
that’s our current thinking at least
a

andylamax

06/29/2020, 11:33 PM
Thank you for the insight
3 Views