Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

280
Visualizações
this@MainActivity vs MainActivity@this in kotlin

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 ?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

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.

over 4 years ago · Santiago Trujillo Relatório

0

this@MainActivity - it is a reference to current MainActivity instance.

MainActivity@this - it is definition of a name of the label, i.e. MainActivity.

More info about labels.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda