Nat Strangerweather
02/13/2021, 4:25 PMAndroidViewModel
so I could pass a context with no memory leak, after this conversation: https://kotlinlang.slack.com/archives/C0B8MA7FA/p1609278349460800?thread_ts=1609277107.460700&cid=C0B8MA7FA
The problem since I've recently updated Kotlin is that this line is highlighted with a leak warning:
private val context = getApplication<Application>().applicationContext
Why this change and what's the point of AndroidViewModel
in that case? Any ideas what I could do to avoid the problem?Ian Lake
02/13/2021, 4:27 PMApplication
class is a Context,
you don't need that variable at allIan Lake
02/13/2021, 4:28 PMval application: Application
if you need to reference a Context variable sometime after initNat Strangerweather
02/13/2021, 4:29 PMLefko
02/14/2021, 7:20 AM