‫We succeeded in generating random numbers using this function.
‫Now we need to get the username from the main activity and share the result through email application.
‫At first I need to get the username from the main activity.
‫For that I'll create another function called receive username and this function returns a string.
‫I'll start with var bundle.
‫It's of type bundle equals to intant dot extras.
‫This line of code retrieves the extras that were added to an intent.
‫So var bundle and its type bundle.
‫This line declares a mutable variable named bundle of type bundle and this question mark.
‫The question mark indicates that the variable can be null.
‫The variable is initialized with the value of intent.
‫Dot extras intent.
‫This is an instance of the intent class in Android development and intent is used to perform operations
‫such as starting activities, services, or sending broadcasts.
‫In this case, it seems like you are working with an activity and accessing the intent associated with
‫that activity.
‫And this is our case which we passed this intent and we put extra which is the key username, and the
‫value is the name entered by the user.
‫The extras property of an intent is a bundle that can carry additional information.
‫It's a key value stored where you can put various types of data.
‫This is often used when you want to pass data from one activity to another.
‫And here I am passing a key username and its value is the name I need to receive it.
‫So I need to pass the key and the intent will give me the value.
‫Give me the key.
‫I'll give you the value.
‫This is the formula here I'll start creating a username variable equals to this bundle.
‫And I'll use this question mark dot get getString.
‫And here I need to pass the key.
‫What is the key.
‫Its username I prefer copying it in order to prevent any errors.
‫So give me the username key.
‫I'll give you the value of this username which is this variable name.
‫I'm passing this name from one activity to another using key value pairs and extras.
‫Return username goes.
‫This function will return a username.
‫And here I need to use the two string method in order to change from bundle to user to string.
‫This is how we receive the username from the first activity or the main activity.
‫So I need to call this function from a variable.
‫I'll name it as username equals.
‫To receive a username function.
‫So in the next video we're going to create another function that is responsible for sharing the username
‫and the generated numbers with the email application.