목록생명주기 (3)
막무가내 삽질 블로그
ViewLifecycle의 대해 공부를 해보고 Activity Lifecycle과 어떤 연관이 있는지도 대해 공부해봤다. 자세한 내용을 아래 참고 https://www.notion.so/imwj/View-Lifecycle-7cf2f8d8de714c05b3560e88968452fb View Lifecycle Activity가 라이프사이클을 가지고 있는 것 처럼 뷰도 라이프사이클을 가지고 있다. www.notion.so
앱이 포그라운드인지 백그라운드 인지 상태를 확인해서 이벤트 처리를 해야할 상황이 있었다. 예전 프로젝트에서는 액티비티에서 확인을 해서 로직을 처리했는데 이번에는 조금 더 수월하게 AAC 라이브러리를 활용하였다. gradle 에 추가해 준다. implementation 'android.arch.lifecycle:extensions:2.2.0' 그 다음 LifecycleObserver 를 상속 받은 후 ProcessLifecycleOwner를 등록해 주고 어노테이션을 활용해 함수를 만들어서 사용하면 된다. 개발자 문서를 참고하면 된다. 전체코드 class TestActivity : TLSActivity(), LifecycleObserver { override fun onCreate(savedInstanceS..
참고자료 Difference between FragmentPagerAdapter and FragmentStatePagerAdapter, getSupportFragmentManager() and getChildFragmentManager() Difference between FragmentPagerAdapter and FragmentStatePagerAdapter Here is a log lifecycle of each fragment in ViewPager which have 4 fragment and offscreenPageLimit = 1 (default value) viblo.asia FragmentStatePagerAdapter deprecated from api 27