Passing +id attribute instead of using findViewById


My function is declared:

    fun myFun(imageView: ImageView) {

The ImageView has this attribute defined in layout file my_activity.xml


And I am able to invoke the function like so


I don’t recall ever being able to do that in Java, nor have I been able to find any documentation on this. Can someone please explain what is going on? Did I just stumble upon another Kotlin feature?

EDIT: I just noticed the following import has something to do with it:



It’s indeed a kotlin feature, but I guess you already knew it after searching for “synthetic android kotlin” :wink: