I have an activity with a variable controller and an nested class A. Inside the A class i want to have access to the controller variable. Hoe can i do this?
class MyActivity: AppCompatActivity() {
private val controller: MyController
....methods of activity...
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
controller = Controller()
// Doing stuff
}
private class MyListener internal constructor(x: Int): LocalClass.Listener {
override fun onCallOne() {
// I get an unresolved reference here
controller.method()
}
override fun onCallTwo() {}
override fun onCallThree() {}
}
}
The above code is made out of AndroidStudio autoconversion when i pasted the same from Java code, where the controller variable is accessible from the nested class MyListener