‫Welcome back.
‫We created the layouts for our activities.
‫Now we need to add the functionality for these activities.
‫I'll start with the main activity.
‫So I'll declare the widgets and initialize them.
‫Let me initialize these widgets.
‫And this refers for this text to view.
‫I need the ID for this edit text.
‫And for the button on the button.
‫And this is the ID, the generate button.
‫This is how we declare and initialize the views.
‫Now we need to add the functionality.
‫So when the user enters his name and clicks on this button, I need to direct him to the second activity
‫and pass his name.
‫So for that I'll use generate button set on click Listener.
‫And we learned about the listeners in the previous videos and how to pass this lambda expression.
‫Here I start with the string or the var name.
‫It's of type string equals.
‫To edit text dot gettext dot toString.
‫I need to pass this name, and to pass this name to another activity, I'll use the intents.
‫I'll use explicit intents var I equals to intent.
‫I'll pass this as the first parameter and I'll import intent class alt plus.
‫Enter import the class and the second parameter is second activity class.
‫Here I specify the type of the second parameter as a class to Java.
‫Then I need to pass the extras.
‫I need to pass the username to the second activity.
‫I dot put extra here, I need to specify the key and the value.
‫The key is username and the value is name, which is the variable that we collect from the edit text.
‫Then I'll call start activity method and start the second activity.
‫This is how we use the explicit intents in Android.