So as you can see here we have our requests as an argument here result called it intense data.
And here first of all you're calling this super version the superclass version of this method superdad
an activity result request code result called data.
And here I have this sweet statement.
As you can see here we have this statement and now we want to switch between the request codes that
we actually receive OK.
So first of all as you can see we have this image request code that is related only to the eye and the
animal.
OK so whenever the user clicks on this animal here on this animal it's going to open this up for this
application.
It's going to open up a directory so that we can actually select an image.
So that request code is related to that specific image view.
So if I click on back here we have a request code and here it's going to actually switch between the
request codes.
So here I am saying the case is request code.
So if the request code is image request code.
OK.
And here I have an if statement if result code.
So here we have this result called as an argument is equal to result.
OK.
As you can see here we have this constant in Android resolved or.
And this means that we could actually we could successfully access the photos application or not and
a directory in our internal storage and we could successfully select an image.
OK.
If the operation was successful.
Now inside this if statement as you can see you or I we have an object of type you are a chosen image.
So the name of this object is chosen image assignment operator.
So here are you referring to these data here of type intense data that get data.
So here it is going to actually select for example one of those images.
Okay.
And then it's going to assign that image.
That path is assigned that path to this chosen image that is of type you or I.
OK.
So for example if I click on this animal and if I select this cat that you hear now of you actually
sign that data to this chosen image that is of type you are right.
And here we have a try catch exception because it may actually we may actually encounter some errors
when we want to access our photos in our internal storage or our photos application.
And here in Detroit try statement as you can see here I refer to the name of my bitmap object bitmap
media store that images that media that map OK.
First of all we need to actually specify the content resolver.
So I referred to the name of this gets contd get content resolver method as you can see here.
So in this way we can actually access the content resolver and for the second argument we need to specify
the chosen image.
As you can see here chose an image the image that we actually received from the internal storage or
from the photos application.
So this is very important.
And now I can actually assign that image to our I am the animal image view or any animal that said Image
bitmap bitmap.
And here we have a camera statement whenever we actually encounter an error or we can actually output
the description of that error to the log as you can see here.
And here we have this break.
And now we can actually break out of these three statements.
So here we need to actually put an order ending curly brace that is related to this class.
OK.
So I mistakenly deleted the ending calibrates of our main activity class.
So as you can see here this is the starting curly brace and this is the ending calibers.
And if I delete it now we have an error.
So I just need to put that in in calibers here and now let's actually run our project again and see
what happens.
So now as you can see our application is running on this emulator.
And now if I actually select this image image here and it this time if I actually select this for example
this fishier now we can see this image here.
This fish.
OK so now let's actually go back to our second activity class.
And now here inside this class I want to actually declare some objects so I'm going to 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 I actually pasted here takes the view text the
name.
So here I am actually declaring some objects of type takes you to name ATX the email th the username
takes the password TXI the gender type.
OK.
And here as you can see we have this image view and you received so in our activity underlines that
example as you can see here we have this error so I just need to click on this clear cashier.
And now as you can see I didn't put our takes fuel for our genotype.
So I just need to select these large takes here and then I need to put it at the center of this linearly
out vertical and double click on it delete the text that it takes for you and for the ID just type in
here to the gender type and then present Enter key on your keyboard.
So here I just need to change this T-2 or capital-T gender gender type.
And then I need to press on on my own and then I need to press on Enter key on my keyboard.
So now it's actually assigned a value match parent for this text view.
So I just selected and assigned a value match parent and then it's actually as you can see here as gravity's
center horizontal and essentially find the gravity attributes and check the checkbox.
That is that says Center underline horizontal.
OK.
So now inside our second activity class inside this uncreate Meffert I want to actually instantiate
these objects.
OK.
So here I am going on pasting some lines of code and then I'm going explain to you what's going on here.
So as you can see here these are the lines of code that I actually pasted here to fix the name.
So here I am actually instantiating these objects that I actually declared inside the second activity
class takes the name find view by ID or that I that use the name th the email find view by ID or ID
that takes the email received.
OK.
So whenever the user press actually enters a value in cities for example in say this it's actually open
our emulator inside is when the user enters a value inside this inside this.
For example email textfield.
We want to actually pass that information from this activity to the second activity.
So if I actually said click on this add the values here.
Now we dont see those values but we have to actually receive those values.
So here you have these two the username or that ID that takes the user name takes the password find
your ID or ID that the password to use the gender type find view by ID or that ID that use the gender
type.
I am received.
Here are the ID thought.
So here I can just type in any animal received.
OK.
So hopefully that makes sense.
And now Im going to actually paste in some more lines of code here and then I'm going explain to you
what's going on here.
So now as you can see here these are the lines of code that I actually place that here.
First of all I created actually an object of type Bondel.
OK.
And the name of this object is X.
And as you can see here I put an assignment operator here and here I called this method get intent.
So it can actually get at the intent object that is passed through this activity.
OK good intent does get extras.
So as you can see here inside our main activity class here for example as you can see here I am actually
passing some information from this activity to the second activity.
And here I am actually putting Dauth information inside this in intent object.
OK.
Intent to put extra.
And these are the information that they actually passed on from this activity to the second activity.
And these are the information that they actually passed from this activity to the second activity.
And here inside the second class I am getting those information by calling these kids intend to Meffert
that's get extras.
So now I have those extras here as you can see I created some valuables of type trick.
The first one is name.
OK.
Assignment operator extras.
So here I am actually referring to these extras here that get strange.
OK so because I want to actually get a value that is of type streambed.
So here as you can see in say this me in a computer class I am passing this.
It is the name that takes the twisted thing here.
This is actually a string value.
OK.
And the key is name.
So inside the second activity class you want to get that value that is that it's keys name.
OK.
So here I just need to get this through.
Meffert OK.
Extras that get strange.
And here I want to get the e-mail as you can see extras that get streamed e-mail.
So she must be the same as the key that I actually specify here.
OK.
Because I want to get that specific value that is passed by using this key.
So it's the second activity class username extras that gets streamed username string password extras
that gets the name password stealing gender type extras that get streamed gender type so hopefully that
makes sense.
And now as you can see I am actually getting more information.
So here I just put those information inside these user interface components for example I can't just
type in the name that said text.
And here I can't just refer to this name here Tony.
OK.
And here I can just again type in the email that said text.
And as you can see I can just refer to this e-mail here.
You made 60 for example a user name you x the user name that said text.
And here I can't just refer to this username here username string value as you can see and hear again
again just typing takes the password takes the password that said text.
And here again just typing password again for the gender type here as you can see I have this takes
the gender type so I can just type in the gender type that said text.
And as you can see here I can't just refer to that gender type here.
Gender type.
So now as you can see in say this main activity class I didn't actually pass the gender type.
As you can see I didn't specify the gender type.
And later I'm going to specify the gender type but for now remember that the gender type is actually
an empty value or Cuvee assigned an empty value to the gender type.
So it can actually pass an empty value from this activity to the second activity for now.
OK.
So let's actually run our project and see what happens.
So before we actually run our project that's actually open our activity underline made that example
here.
And as you can see here for this it takes here as you can see if let's actually find the hint attributes.
So as you can see here this is the hint attribute and here just for the password just type in here email.
Ok please enter your e-mail.
I did a mistake here.
So now I actually fixed dismiss the here and now I'm going to run or run my project again here.
So now as you can see our application is running on this emulator.
So for the name just type in here for example John and for the email for example John want to free at
sign and sign yahoo dot com and and for the username.
I can't just typing for example Johnny.
And for the past for for example a number here and here I want you to choose an image.
So I just want to select this image here and here for example I want to choose this officiel.
And then here I don't want to specify the gender type here for now.
And I just need to click on this button here at the values.
And now we can see these values here but we cannot see the image here.
OK.
So let's actually go back to our second activity that of a file here and now I want to actually get
the image.
So now I'm going to 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 I actually pasted here.
First of all I created an array of byte and the name of this era is both R8 and here I put an assignment
operator extras.
So here I actually l'affaire through these extras here.
That gets right.
Ari OK.
So here I want to actually get the post Arey from these extras.
And here inside this main activity that I will find here as you can see I have passing this image.
I actually are converting that image to an array of bytes.
OK.
And here as you can see I am actually passing that byte Arrey to the second activity and this is the
key picture.
So here I just need to copy this key here and inside the second activity that Javal find here I just
need to put that key here extras that gets poked at a picture.
And here I created an object of type bitmap so bitmap bitmap.
Assignment operator bitmap factory that de-code byte array.
So here I need to pass this byte had a.
Here.
OK this is the point array for the first argument.
The second argument specifies the index of the byte Auret that you want to actually get because I want
to get the picture entirely.
OK so this is important that you put the index 0 for this argument.
OK.
And it is going to actually specify the index of the post.
Try that with the first index of the base rate that you want to actually get the information.
And this is going to be the length of the boat at a boat at that length.
And here I just need to refer to these items you received here.
I received Dud's set image bitmap bitmap as you can see here.
So now let's actually run our project here and let's see what happens.
So now as you can see our application is running on this emulator.
So for the name just type in here for example again John and here for the email I can just type in a
value and here are for the user name.
Again I can't just type in another value Johnny.
And for the past for an added value and here I want to specify the image so I can select that image.
And this time for example I want to select this line and I just need to click on this button.
And now I can see this image here.
So as you can see here now are we can see this image and we managed to successfully sent the information
from this activity to another activity.
But now I want to actually select a gender type for example main and then add that in the type to this
activity.
So let's actually see how we can do that.
Let's see how we can do that.
And inside this main activity that will find here and now for example here are inside these unchecked
change our method here.
I want to actually specify that.
What kind of what kind of gender type the user selected.
OK.
So here I can't just create a switch statement and here I can just refer to this checked ID in order
to actually differentiate between for example between these two radio buttons.
OK.
So here I am just typing r r that Id dot.
So here inside Apprentice's I can just refer to this checked ID here because I want to actually switch
between the IDs of the of the radio buttons inside a radio group.
So here I can just type in case.
So if the user clicks on the radio mail here now I want to check that are that Id dot that radio made.
OK.
Colin bridge.
And if the user clicks for example check the radio.
Female.
Now I want to check that case are dot ID dot radio.
Female colon break.
So now here I can actually putting up some of the USB for example I can put in the logic.
So here as you can see in our main activity class I have these gender's type here.
That is of type string.
OK.
So now I can just typing gender type gender type assignment operator for example.
And instead of double quotes I can just put in made.
OK.
And I need to put in a semi-colon at the end of my statement.
And here I can just type in gender type assignment operator to double quotes female.
OK semicolon.
So now as you can see I have actually assigned the information that is required to this or type.
So if they use their checks this radio button is made the radio button the value of this genotype type
is going to be made.
And if that use of text is female radio button the value of the same gender type is going to be female.
And as you can see here in Anchal each Merfeld here as you can see I am actually passing these gender
type here from this activity to the second activity this gender type String valuable.
So inside insight is a second activity I am actually receiving that gender type.
As you can see here.
And and then I am actually putting that gender type in in RTX the gender type text view.
So let's actually run our project and see what happens.
So now as you can see our application is running on this emulator and here I want to actually specify
a name.
For example this name or this e-mail.
OK.
And for the username and just for example typing for example another rally you and other password.
And for the image for example I can just select this image.
And for example select is Dolfin.
And here I can just select this male radio button and then at the values you can see that the gender
type is made.
OK.
And if I go back again this time check this female here and at the values you can see this female here.
OK.
So hopefully that makes sense.
And another important point that I want to talk about is that inside this main activity that I will
find here after here after this start activity Meffert if we actually type in Finnish Let's actually
build on our project and see what happens.
So here our application Iran is running on the simulator.
And if you actually click on this values here now we can see this image here.
OK but now let's actually click on the back button here and see what happens.
And now as you can see our application is actually destroyed from the memory.
And that's because of this finish method here that I put here this finished if it is going to actually
clear this activity from this memory and we cannot actually access that activity again.
So here in our emulator whenever the user.
So if you actually did on my project again here now you know emulate here if I click on this at the
Values button here and if I can come back here now the first activity is actually gone and we cannot
and we cannot see that activity here again.
So that's that was another point that I wanted to talk about in this video.
So I just need to delete this or finish my effort here.
So I think that's enough for this application and for this tutorial.
So 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 tutorial.