Ian Lake and Manuel Vicente Vivo demonstrate how to integrate Jetpack Compose into existing Android apps using ViewModel, LiveData, Room, and Navigation.
Jetpack Compose integrates seamlessly with other Jetpack libraries. There's no need to rewrite everything from scratch to start using Compose in your app. The UI code might change, but the rest of your app architecture remains intact. In this Session, we add Compose to an existing app that already uses ViewModel, LiveData/Flow, Paging, Room, Hilt, and Navigation! Learn how the libraries work with Compose, when to use ViewModels, and how to get the most out of Navigation Compose.
Resources:
Compose Pathway → goo.gle/compose-pathway
Compose documentation → goo.gle/compose-docs
Compose Samples → goo.gle/compose-samples
Speakers: Ian Lake, Manuel Vicente Vivo
Watch more:
Android and Play at Google I/O 2021 Playlist → goo.gle/io21-AndroidDevs
All Google I/O 2021 Technical Sessions → goo.gle/io21-technicalsessions
All Google I/O 2021 Sessions → goo.gle/io21-allsessions
Subscribe to Android Developers → goo.gle/AndroidDevs
#GoogleIO #Android #Featured #JetpackCompose
product: Android - Jetpack Compose; event: Google I/O 2021; fullname: Ian Lake, Manuel Vicente Vivo; re_ty: Premiere;
Why it's here
1 person recommends this
What people say. Recommended by Google and developers for understanding how to structure ViewModels and navigation in Jetpack Compose.
Moments people linked to
C
C. Hellmannon Stack Overflow • Recommends
On “ViewModels creation is not supported in Preview”
You could use an approach that looks like this which will show up in the recommended video bellow:
@Composable
fun TestView(
action: MainActions,
viewModel: OnboardViewModel = getViewModel()
) {
TestUI(onClick = viewModel.clickMethod())
}
@Composable
fun TestUI(onClick: () -> Unit) {}
@Preview
@Composable
fun TestUIPreview() {
MaterialTheme() {
TestUI(onClick = {})
}
}
There is a recommendation from google in this video at the selected time: link to this video