Android class with context in object field in Kotlin

Viewed 8685

Is it ok to have a property in object class in Kotlin that has a context in it? In Android it is a bad practice to put context related objects in static fields. Android studio even highlights it and gives a warning unlike Kotlin where there is no warning. Example object:

object Example {
    lateinit var context: Context

    fun doStuff(){
        //..work with context
    }
}
2 Answers
Related