Kotlin / Anko Button Onclick Not Working
I'm fairly new to Kotlin, and I'm using Anko DSL (with some XML) to generate an alert. My issue is, the onClick{ ... } function doesn't happen when I click the button. Everything e
Solution 1:
The lambda parameter that positiveButton
takes is not a setup function, but the click listener itself, so you can write your code directly inside it:
positiveButton("OK") {
info("Testing")
}
The onClick
function that you're calling inside it is coming from another outer scope, and is overriding the listener of one of the outer views, presumably the listener for the root of the included view from the XML.
Post a Comment for "Kotlin / Anko Button Onclick Not Working"