I am trying to do the singleton pattern with Kotlin and I'm not understanding why I am getting null pointer exception here
object AppController : Application() {
private val queue: RequestQueue = Volley.newRequestQueue(applicationContext)
fun getRequestQueue(): RequestQueue {
return queue
}
}
In my main activity I am calling:
private val controller = AppController
private val queue = AppController.getRequestQueue()
Ay help is appreciated. Sorry. I am not sure why code isn't formatting properly.