Q&A
Fragment UserViewFragment{755083c (97350660-0d15-4791-b814-9fd04e9c5cc3)} not attached to a context 오류문의
저는 override fun onDestroy () { super . onDestroy () registration !!. remove () } 이렇게 사용하고 있습니다~ 액티비티나 프래그먼트의 생애주기에 따라 화면이 사라지는 부분에서 remove를 해주면 됩니다 registration은 var registration : ListenerRegistration ? = null 이렇게 전역으로 선언하고 스냅샷으로 사용하면 됩니다 registration = firestore !!. collection ( "reunions" ). document ( reunionUid ). addSnapshotListener { value , error -> if ( value == null ) return @addSnapshotListener reunionDTO = value . toObject ( ReunionDTO :: class . java )! }
- Likes
- 2
- Comments
- 7
- Viewcount
- 532

