I'm working through a tutorial that includes: ``` ...
# android
e
I'm working through a tutorial that includes:
Copy code
rollButton.text = "Let's roll!"
        rollButton.setOnClickListener {
            Toast.makeText(this, "button clicked", Toast.LENGTH_SHORT).show()
        }
I know the first line would be:
rollButton.setText("Let's roll!");
in Java. Why doesn't the next statement become the following in Kotlin:
Copy code
rollButton.onClickListener = ...;
i
Properties need a getter - while there's a
getText()
to go with
setText()
, there's no
getOnClickListener()
so it isn't eligible to be converted into a property
✔️ 2
e
That makes total sense. Thank you, @Ian Lake.