``` class CustomApplication: Application() { ...
# codereview
s
Copy code
class CustomApplication: Application() {

    companion object {
        private var INSTANCE: CustomApplication? = null

        @JvmStatic
        fun get(): CustomApplication = INSTANCE!!
    }

    override fun onCreate() {
        super.onCreate()
        INSTANCE = this
    }
}
Or
Copy code
class CustomApplication : Application() {

    companion object {
        lateinit var instance: CustomApplication
            private set
    }

    override fun onCreate() {
        super.onCreate()
        instance = this
    }
}
Not sure if this is more appropriate for #android. Which one would you prefer for creating an Android Application class? And why?
2️⃣ 4
🤯 1
e
Prefer 2️⃣ to avoid Nullable types in Kotlin world.
✔️ 1