I am making a custom view for Android.
I am going to clone the layout by calling clone (this
), but it shows error, when I use clone (this@mycustomclassname
), it works.
It's still confused. Anyone knows the meaning of this@classname
in kotlin?
I am making a custom view for Android.
I am going to clone the layout by calling clone (this
), but it shows error, when I use clone (this@mycustomclassname
), it works.
It's still confused. Anyone knows the meaning of this@classname
in kotlin?
This is a qualified this
. You can access this
from an outer scope.
As this
can mean different things (part the referenced page):
To denote the current receiver, we use this expressions:
- In a member of a class, this refers to the current object of that class.
- In an extension function or a function literal with receiver this denotes the receiver parameter that is passed on the left-hand side of a dot.