Here is i am describing how to transfer variable or value from one Activity to Another Activity in Android Application.I am using Android Studio 3.0.I hope my code will help you. You can use this code in button event or any other place where it is required.Set Data in Activity
val myvalue="I am from Main Activity"
val myActivity = Intent(applicationContext, Another_activity::class.java) //name of activity to launch
myActivity.putExtra("value",myvalue) // value will save of your myvalue variable used for another activity
Hi Developers as we always juggle with findViewById() in Android activity class . Some time we forget to typecast xml into Kotlin or java . So good news for Kotlin android developer.
Kotlin Android Extensions
Kotlin Android Extensions are another Kotlin plugin that is included in the regular one, and that will allow to recover/find views from Fragments, Activities, and Views in an effective way.see how easy it is ….Step 1.
Add Kotlin Android Extensions in Gradle (Project)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' //this the main plugin