Fragmented - Android Developer Podcast
115: Architecture Components with Akshay Chordiya
- Autor: Vários
- Narrador: Vários
- Editora: Podcast
- Duração: 1:04:47
- Mais informações
Informações:
Sinopse
In this episode, we talk about the different parts of Android architecture components. We've had episodes on Room and the paging library, so in this one, we thought we'll touch a little on Lifecycle Owners & Observers, ViewModels, and LiveData. Akshay Chordiya helps break it down. Listen on! Show Notes Android Architecture Components Lifecycle Handling lifecycles with Lifecycle-Aware Components Lifecycle Owner Lifecycle Observer Best practices for lifecycle-aware components Caveat: handling onStop events ViewModels Architecture Guide: ViewModels View Model Code snippet for a ViewModelFactory: class UserVMFactory( val user: MyUser ) : ViewModelProvider.Factory { override fun create(modelClass: Class): T { return when { modelClass.isAssignableFrom(UserVM::class.java) -> UserVM(user) as T else -> throw IllegalArgumentException("Unknown ViewModel class") } } } LiveData L