setContent: Where Your UI Begins
Hook your Composable tree into the Activity.
Connecting Compose to Android
Your Composables need a home. The setContent call inside an Activity is the bridge that hands your UI tree to the Android screen. 🔗
Inside onCreate
You call setContent from an Activity onCreate. That is the moment Android tells your app it is time to show a screen.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent { Greeting() }
}All lessons in this course
- Writing a @Composable Function
- Live Previews with @Preview
- Calling Composables from Composables
- setContent: Where Your UI Begins