mrobinson
06/01/2017, 11:50 PMclass MyService : Service() {
val myIntent = Intent(this, MyActivity::class.java)
/* Other stuff */
}
This causes an NPE on Context.getPackageName()
on the line where I'm making the Intent.kevinmost
06/02/2017, 11:55 AMval myIntent by lazy { Intent(this, MyActivity::class.java) }
. That way it won't be evaluated until the first time you access the val, which should be once the context is available