세션 노트
AAC ViewModel
Info
Info
Info
추가 자료
🤔 What is AAC
AAC : Android Architecture Component
manage Application lifecycle
- detect component changes
- prevent memory leak
- load data on UI
LiveData
notify data changes on database to view
ViewModel
store UI states even
Room
SQLite object mapping library
- Use it to avoid boilerplate code and easily convert SQLite table data to Java objects.
- Room provides compile time checks of SQLite statements and can return RxJava, Flowable and LiveData observables.
Lifecycle
Best Practice
UI controller: activity, fragment … → should not acquire their own data → data should be on ViewModel
Use Kotlin coroutines
Usage
- Video play
- Network connection
- animation play
- GPS
View Binding
alternative to findViewById(<!—id—>)
- Null safe
- Type safe
vs data binding
→ data binding은 <layout>
안에 생성된 데이터 바인딩 레이아웃만 처리한다.
→ @+id
만 있으면 모든 view 참조/binding 가능