Hello Kotlin people
I’ve been doing the developer.android tutorial (https://developer.android.com/training/basics/firstapp)
In the DisplayMessageActivity file, Java version:
// Get the Intent that started this activity and extract the string Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
The corresponding snippet in the Kotlin version:
// Get the Intent that started this activity and extract the string val message = intent.getStringExtra(EXTRA_MESSAGE)
So in Kotlin I don’t need to declare intent or to specify that EXTRA_MESSAGE comes from MainActivity?
Also in the Kotlin version I failed to import android.content.Intent in DisplayMessageActivity.kt and the app works fine?
I feel I understand what’s going on in Java but the Kotlin version confuses me a bit. Any help would be greatly appreciated!