Group Group Group Group Group Group Group Group Group

Your First Kotlin Android App · Starting and Ending the Game | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4936497-your-first-kotlin-android-app/lessons/28

What does “this” mean in the endGame function?

@rbondoc Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @shah95rukh, the this keyword refers to the current instance of the MainActivity class the code is currently being run in. The MainActivity instance is being passed to the Toast.makeText function as the context argument. This will tell the Toast class that the text should appear over this MainActivity.

@rbondoc, please, help me! In this string: tapMeButton.setOnClickListener { view -> incrementScore() }
Android studio send warning (Parameter ‘view’ is never used). What’s wrong?