[Android, MVVM, Coroutine] 활용 #3 - ViewModel, LiveData의 Coroutine 이 글은 아래 포스팅을 기반으로 작성되었으며, 상세한 내용은 링크에서 확인하시기 바랍니다. 2019/11/14 - [개발이야기/Android] - Easy Coroutines in Android: viewModelScope https://developer.android.com/topic/libraries/architecture/coroutines#livedata https://proandroiddev.com/the-death-of-presenters-and-the-rise-of-viewmodels-aac-f14d54b419a ViewModel도 Activity나 Fragment처럼 생명주기를 갖습니다. 따라서 ViewModel의 생명 주기에 맞춘 Coroutine Scope을 설정한다면 coroutine.. 개발이야기/Android 5년 전
Android Architecture Components #3 - LiveData LiveData는 data holder 클래스로 data가 가진 값들을 확인할 수 있으며, 다른 observerable과 다르게 app component의 lfe cycle에 따라 observing 여부를 지정할 수 있습니다.LiveData는 LifeCycle이 STARTED나 RESUMED인 상태를 Observer가 active된 상태로 간주합니다. LiveData는 주어진 lifecycle에 의해서 관찰될수 있습니다.이는 Observer와 lifecycle이 pair로 등록되며, 등록된 Observer는 LifeCycleOwner의 상태가 active(STARTED or RESUMED)일때 wrapping된 data가 변경되면 noti를 받을 수 있습니다.observe(LifecycleOwner ow.. 개발이야기/Android 7년 전