bryan
02/07/2019, 6:40 PMLiveData observer?nounours
02/07/2019, 6:44 PMbryan
02/07/2019, 6:50 PMtseisel
02/11/2019, 9:15 PMmyLiveData.observe(this, Observer { ... }) where this is your Activity or Fragment, you're ensured that the Observer is tied to the lifecycle of that Activity/Fragment, i.e. it will unregister itself in onDestroy().
Otherwise, it will be unsafe to reference a Context in that Observer if you register it with myLivedata.observeForever(observer), unless you unregister that observer with removeObserver(observer) (but if you do that in a Fragment, why wouldn't you use observe instead ?)