So as you can see here these are the lines of code that I actually pasted here.
So in line for 49 as you can see here I created an object of type intent.
OK.
And the name of this object is data.
So I want to actually get some data from this activity and send those data to the main activity.
OK so intent data assignment operator new intent and in line 40 as you can see here.
I want to actually get the value that is actually assigned to these EDT name here and as you can see
through this editor named Eddie Tex.
All you want to actually get the value that is inside of this text field and at Want to actually pass
that value to the main activity.
So here I need to put a type in data that puts extra.
So if I put extra actually access to arguments and the first argument is going to be the key.
So the key is going to be a request text fields name.
So I actually created this key in line 15 as against it here inside the second activity class.
The quest text fields name and I assign this value request name to this keep.
OK so this is going to be the key and the value and the second argument is going to be the actual value.
So this is the actual value that you want to pass from this activity to the main activity.
So it is the name that takes that to history.
So the second argument the type of the second our argument must be of type student.
So as you can see here are the type of the document it must be strange.
So I need to actually type in.
It is the name that takes that to a stream.
Ok so in this way I am actually getting this change of value of the EDT name and in line 41 as you can
see here again data that puts extra.
OK so this time I want to actually get this edited e-mail.
So the first argument is going to be the key which is going to be all types things right.
Request takes will e-mail.
So I created this key here in line 16 as you can see the quest text with e-mail.
And I assigned this by the request made to this a constant.
Right.
So that is key.
So and he and as you can see the second argument again must be of type screen.
So if he made that get takes that was strange.
OK.
So in this way I'm actually getting the string value that that is actually inside of this textfield
it it's made an inline 42.
Again as you can see data that puts extra as against can see here.
So again I want to actually get this username.
So the quest text with username.
So this is the key comma.
And now I want to actually get the get the string value that is inside of these it is to use that name.
So it has a user name that get text that was think.
So it's going to actually convert the de-value that is inside of this text field into a string value.
And then we can actually get that value.
OK.
So here in line 43 again they put extra requests.
Textfield password.
Come on EDT passport that get text that was 3.
So now we want you to get the passport.
OK.
So this is going to be the key right and now in line 44.
I need to put this card here said resolved.
And this method actually accepts two argument as you can see here.
The first argument is going to be resolved.
OK.
So this is actually a code that specifies that we can actually spit successfully pass this data to the
main activity.
OK.
So resolved OK is very important.
And this means that it is OK to actually pass the pass the data to the main activity.
Karma as you can see here and the second argument is going to be that data which is off the intent.
Right.
So an England 44 45.
They actually put the Smurfit here finish.
Get rid of the second activity and we can actually it's like actually pressing the back button on the
device.
OK.
This finish is going to actually get rid of the second activity.
And then we can actually see the main activity.
OK so now let's actually go back to our main activity the double fight here.
So in order to get that data up that is actually passed from the second activity class we need to actually
override MFL that we actually inherit from these from the activity class so that if it is an activity
is locked inside this main activity class as you can see.
I want to actually write a method in order to get that data up that we want to actually receive from
the second activity class.
OK.
So inside this meeting with the class again just typing on activity result as you can see here the autocomplete
feature of the Android studio is helping me to select this method an activity result.
So I just need to press not enter key on my keyboard.
So as you can see here now we actually override it.
The Smurfette on activity result and this move it actually accepts the argument.
The first argument is going to be the request code I need to actually create a request code that is
actually specific to these bits and move here because I want to do this.
Intent OK because I want to actually move to the second activity by clicking on the speedier and move
right.
So here as you can see here inside this method inside this uncle Meffert then the user clicks on disputes
and move on to actually move to the second activity right.
So he had to actually create or request code that is specific to this intent.
And this means that it is actually exclusive or only exclusive to this intent.
And this happens only when the user clicks on this button.
Right.
So here in our main activity class I need to actually create our request code so private the access
modified of the request card is going to be private.
And this is going to be our final static.
And this is going to be of type integer.
So here I want to actually create our request code in our request called constant.
So here the access modify it is going to be private and this constant is going to be actually static
final.
OK.
And this constant is going to be of type integer and the name of this constant is going to be a request
code request code move.
OK.
Assignment operator and here I can get you to assign the value of.
And that I need to put a semicolon at the end of my that my statement here.
OK request code move.
So now inside my uncle method instead of actually typing this Meffert start activity I need to change
this method to start activity for a result because I want to get the data up from the second activity
and put those data inside the main activity.
OK.
So I need to actually instead use this method start activity for exact because I want to actually move
from this activity to the second activity in order to get some data.
And then when the user clicks on that Dunbarton or when the user clicks on the news that presses the
button on the device that they're going to actually pass those data to a data that they're actually
inside of those that were put inside of those text fields are going to be passed to this activity.
So I need to overwrite this.
I need to actually call this method start activity for result and insight Apprentice's here I need to
actually pass two arguments.
The first argument is going to be of type intent.
So this is the instance that I actually created in 1934 and the second argument is going to be a request
code.
So request code move.
OK.
That is exclusive only to this intent object.
OK.
This is very important.
And here inside this unactivated resolved Meffert as you can see.
All right it is Smurfit in our class.
In order to get the data that we received from the second activity even the user clicks on these are
done.
But in all of that use that a oppressor's on the back button on the device.
OK.
So here as you can see we want to actually pass this data as you can see here to the first activity.
OK.
So the main activity so that's what actually created this object which is the intent and the name of
this object is data.
And here I am actually putting these extras to this object in data as you can see data to put extra
the name data that put extra EDT emailed data that put extra Editta username data that put extra Editta
password and then I actually called this Meffert set result.
So this if it accepts two arguments the first argument is going to be resolved.
OK.
And this means that it is OK to pass the data from this activity to domain activity and the second argument
is going to be the data object.
And actually I actually called this it's finished so it's going to try to get rid of this second activity
class and then we can actually see that our main activity class.
OK.
So let's actually go back into our main activity class here and is an activity result.
I need to actually create an if statement so if I request code so as you can see here we have this request
as an argument of this method right.
The first argument is request code.
So if request code so here I am actually referring to this request code here that I receive as an argument
from the Smurfit If request code is equal to this request code that is actually related to this intent
as you can see here.
OK.
Request code move that he had as you can see I created this request got here 1000.
Right.
So if request code is related to this request called here request code move and here I need to put an
ant operator here and the logical operator.
And here I want to put another condition and result code is equal it is equal to the result.
OK.
And this is mean that this means that we successfully got the data from the second activity and here
inside the curly braces of this statement.
Now I can actually put the logic in order to receive the data from the second activity class and put
footless data into my text views as you can see here I have some textbooks here.
And I want to actually for example get to get these TXI the name of the user for example enters our
name as you can see here into this a text field here.
I want to actually get that value and put it here in say this activity underlined minute example and
put it here.
It is up to the name here.
This is actually our text view.
OK so I want to actually get those data and put them here into my text.
So inside is main activity that I will fight here at INSIDE is an activity result here as you can see
I have this if statement here.
So inside this if statement I want to actually paste in some lines of code here and then I'm going to
explain to you what's going on here.
So as you can see here these are the lines of code that actually pasted here.
So in line forty nine I actually created a variable which is of types 3 and so on.
So here I want to actually hold a value right.
So strange main assignment operator as you can see here.
So here I want to actually assign a value to this value bet which is of types 3.
Right.
So student name assignment operator and here as you can see I actually referred to the name of this
data object that I receive as an argument from just an activity these are Smurfit so data that get streamed
extra.
So you want to actually get the string value that you received from the second activity.
OK.
So here as against inside Apprentice's of this Meffert I am actually referring to the name of that key
that I created inside the second activity class.
So inside the second activity class as you can see I created these keys here and I actually declared
these keys as public and static so I can refer to these keys to the name of these keys by just referring
to the name of this class and put a dot notation and then the name of these keys.
For example I can actually access this request textfield name by just typing a second activity that
request a Sweetney.
OK.
So as you can see here I put these keys here in order to relate these keys with these values so that
inside this main activity class by just referring to these keys I can access these values as you can
see here.
So for example is a request textfield name is related to this EDT name here.
As you can see it is unique that it takes that with string or for example this request text field.
Email is related to this EDT inmate.
This one request takes with username is related to this Editta username and this one request textfield
password is related to this it is e-passport OK.
So inside is main activity class as conceived by you referred to the name of that key second activity
that the request takes with name.
And now I can actually access the value that is related to this key and assign that value to this named
variable.
So when the user enters a value insight this takes real here and when the user clicks and is done button
or the back button on the device on the device that value is going to be assigned to this.
It takes this up to evaluable and then I can actually assign that value that is assigned to the two
that's valuable into the station name.
OK.
So inside this main activity class as you can see I created this variable name and here you want to
assign that value.
That is a sign that the user actually entered on the textfield incite the activity Underland second
that examine as you can see here.
And I can actually assign That's value to the name variable.
So in line first as you can see here I created another variable and the name of this value but is strange
and the name of this variable is e-mail that the data table of this value is strange.
So strange e-mail assignment operator.
Again I'll refer to the name of this argument which is of.
Right data that gets 3 extra.
OK I want to get a string value.
Again.
I actually referred to the name of this key that is inside of this class.
Second activity that request text field e-mail.
So I want to get the value that is related to this keep the quest text via e-mail.
And again in line 51 I created another valuable stream username assignment operator data.
So here I referred to the name of this object which is of type and data that get string extra.
So here I want to get a string value.
So second activity that requires textfield username.
So I want to get the user name it username value as you can see he had this key is related to the user
and a value right.
And in line 52 I created another variable and the name of this by the above is password assignment operator
data that gets an extra second activity at the request textfield password.
OK so I'll refer to the name of this key.
So this key is related to the EDT passport.
Insight is activity underly second not exempt.
OK so now inside this main activity class and inside this unactivated result I am actually getting those
values and I am assigning those values to these variables.
So here I can just simply assign those values that are assigned to these valuables to these takes.
So for example TXI the name that's a text name.
As you can see here this name that I actually created in 9:49 inside is an activity result.
Or for example in 955 55th the email that said text M8 in 956 takes the user name that said text user
name as you can see here takes the password that said text password right.
So now let's actually run our project and see what happens.
So now as you can see here my application is actually running on this emulator here.
So let's actually click on the spot in here move the second activity and here for the name I can actually
assign a value for example Jack and the e-mail is going to be for example Jack at sign yahoo dot com
or a D in the username for example is going to be for example Jackey and the password is going to be
for example a value.
OK it doesn't really matter.
And as you can see here the input type is password so we can see can't see this value here.
Right.
So now I just need to click on the stand button here as you can see.
And now we can see these values here in my main activity class.
OK Jack.
And here as you can see this is the e-mail deck at yahoo dot com.
Jacki this is the username and this is the password.
OK.
So not just that.
For example if I assign a value here or somebody who's here as you can see here as an e-mail or username
and value for 4:04 or if I click on dispatch button here we cannot see those values here.
When you actually click on this back button those logic those lodges are not going to be executed.
I actually put these logics of actually getting the data as you can see here creating an object of type
or intent on putting those values into these data object and calling this method set these out.
And this a finished method as you can see these ladies are actually inside of this unclick Meffert.
We have another API.
We have a piece regarding our clicking on the back button on the device.
And we could actually use those a.p eyes in order to use this logic when to use it for example a presence
on the back button on the device.
I'll talk more about a piece in the intermediate Android or section of the course.
But for now are just notice that if you put these logic's here you put this logic here and this logic
is going to be executed only of any use that presses this button here not dispatch with another device.
We have some API.
So we could actually use a set that actually inside and the documentation in order to actually do something
when the user clicks on his back button on the device.
And for this application I just wanted to show you how we can actually get some data from the second
activity and put them in your main activity or your first activity OK.
So later on we will be creating more complex applications and you will be familiar of it more API in
Android.
OK.
So thank you very much for watching.
And I think that's enough for the studio audience.
If you have any questions please post the discussion in the course and then I'll do my best to answer
all of your questions.
Thank you very much for watching and I'll see you in the next year Tony.