As you may see that
this@MainActivity or MainActivity@this
is valid while starting activity in kotlin. I tried to find out answer but I did not found anything. Can anyone know about exact difference of it and which one valid ? Why it allowed both ?
According to Kotlin's Grammar documentation,
MainActivity@this is just a label for this
with the name "MainActivity". You can set whatever label you want.
this@MainActivity is an actual reference of this
from MainActivity
Hope I make it clear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With