onKeyListener

Report a typo

Select the blocks of code that will compile successfully.

a)

val button: Button = findViewById(R.id.button)
button.setOnKeyListener { v, keyCode, event ->
    // TODO 
    false
}

b)

val button: Button = findViewById(R.id.button)
button.setOnKeyListener { v, event ->
    // TODO
    true
}

c)

val button: Button = findViewById(R.id.button)
button.setOnKeyListener { v, keyCode, event ->
    // TODO
    true
}

d)

val button: Button = findViewById(R.id.button)
button.setOnListener { v, keyCode, event ->
    // TODO
    true
}

e)

val button: Button = findViewById(R.id.button)
button.setOnListener { v, keyCode ->
    // TODO
    true
}
Select one or more options from the list
___

Create a free account to access the full topic