Home>

We become indebted to.
I am trying to implement Android application development with Kotlin.
I implemented OnClickListener on Acitivity and tried to make click respond to the whole screen, but click did not respond.
Isn't it possible to make the click react to the whole screen by the following method?
I would be grateful if you could teach me.

class MainActivity: AppCompatActivity (), View.OnClickListener {
    override fun onCreate (savedInstanceState: Bundle?) {
        super.onCreate (savedInstanceState)
        setContentView (R.layout.activity_main)
    }
    override fun onClick (v: View) {
        // I want the code here to be executed, but currently it is not executed even if I click it.
        println ("onclick")
    }
}

Above, thank you very much.