So here as you can see we have actually a variable of type assets manager and the name of this society.
It is assets.
And then I was an assignment operator here and then I called the Smurfit good activity that get assets
so the Smurfette assets is going to actually allow us to access the assets folder that we have here
inside our project.
As you can see this is actually the structure of our project and here we can actually see the assets
fall there.
And that's the purpose of this line of call here if we can actually to access these assets for them.
And you can actually just by referring to the name of these assets here I can access this assets folder
and then I can actually access the values that are inside of these assets folder.
So now let's actually go back into our code here.
As you can see we have actually a tribe like here and we have actually a catch block.
So let's first let's actually look at our pro-black here so try and now as you can see here inside Apprentice's
of this tripe like here I put a line of code here.
So input stream and as you can see the name of this variable is stream.
So the data type of this variable is input stream and then I put an assignment operator here.
And then you referred to the name of these assets here in order to access the assets for inside our
project.
And now I want to open the assets folder and I want to actually access the image that is inside of that
assets folder.
So as you can see here assets that operate assets that open and then first I need to actually specify
that up which folder you want to actually access the images.
So for example let me show you the structure of the project as you can see if we have two folders.
The first one is that tape Underland animals folder.
And the second folder is on that animal for animals for that.
And this false folder is actually for fun but we want to actually access the images right.
So now first I need to specify actually the animal type tame animal or wild animal right.
And then I actually put this plus operator here.
And then inside the double quotes as you can see I put a slash and then again another plus operator
here and then here I need to specify the name of the image right.
So next animal image name as you can see here.
This is going to be the name of the image and then for example I can I see the image plus dot P and
g as you can see here.
So now let me show you the emulator as you can see this is our emulator and here this is actually the
image of the animal that we want to show to the user.
So here because I want to actually load this image here I'd need to actually access First of all the
assets folder as you can see here.
And then I need to open the assets folder and then first of all I need to specify specify the type of
this animal whether this is actually a tame animal or a wild animal.
So if we put this animal type here plus slash plus And then I need to specify the name of the animal.
So our next animal image name as you can see here I referred to the name of this Raddy label that actually
holds the name of this animal.
Plus dot P and G.
So it's very important that you actually put this plus the piano here because we actually get this next
animal in its name from these animals names cuius least here from this list.
And the images that are inside of these animals names is this but I actually doubt that it does indeed.
OK.
So it's very important that we want to load the image to the image view here.
It's very important that you specify the name of the animal and then you need to actually add to this
that into here so that we can actually load this image here inside our image view.
So now as you can see if you have this stream here and then let's actually go inside these tribal like
here.
And as you can see we're actually actually created a variable of type tribal.
So anality actually double click on the map here in order to make this area wider.
So triable and the name of my valuable is animal image assignment operator.
And then you referred to the name of this tribal class that create frumps upstream.
So I want to actually create an image from a stream.
So here we are specified in say they're actually inside their pantheists of this tree block here as
you can see I specified this dream right.
I created a variable of type input stream and then I actually opened the assets for them and then I
actually accessed this specific image that I want to actually load here.
So here I actually created valuable after each of triable tribal animal image assignment operator.
So Dr. Bell thought create frumps stream and then decide if it accepts two arguments the first one is
this thing that you specified here inside the prentices of this block.
And the second argument is the name of the image that you want to load here.
So the next animal image name as you can see here.
Right.
So we actually created this value but here in line number three hundred and twenty nine next any image
name.
And now in order to make this concept more clear let me actually call this sniff it again.
So triable dots create create from Stream.
And now let's actually look at the arguments.
The first argument is this is an input stream as you can see here.
So we created an input stream object here and now let me show you the actually the second argument which
is actually of type screen and the name is source name.
So the source name is next animal image name the name of the animal that you want to actually load here.
So hopefully that makes sense.
And now as you can see in line number three hundred forty five I actually first took this image view
I and you and him.
So this is actually the image for you that set him a tribal animal image.
Right.
So in this way we can actually look at the image here and then as you can see here all you want to actually
are for example of when you want to show the next question I've been able to show the next guess the
next animal image to the user.
You want to animated so animate animal Cooley's false.
So for the animate out boolean value but a the value false.
So it's going to actually create an animation effect that starts from here and ends here.
So I actually showed you this concept.
I actually show you this I showed you this animation.
In fact in the previous tutorial in the previous tutorial.
So now if we actually for example choose the rabbit here now it can actually perform and animate out
and then as you can see it's going to perform another animation in fact that starts from here and ends
here.
In order to show the next image.
So animated out so animate animal is false.
So the for this argument I passed the value falls and then here we have the scratch block here.
So this test here is going to actually.
For example if we have problems in order to actually access the images inside our assets folder does
catch up blocking is going to catch that exception.
And then it's going to actually lug a message like that.
Eat animal cookies and the message is there is an error Catinat Plus next.
And in one image name so it says there is an example.
If the device cannot actually access the image it's going to actually just put this value in the console.
There is an irritating and then it's going to just put the next animal image name to the console and
then it's going to just put a description about this exception in the console.
So here let's actually look at the other lines of code here in line number three hundred and fifty free
as you can see here.
So now let's look at this line of code here.
As you can see it referred to the name of this class collection's.
So here this is actually a predefined class in Java.
And we can actually access this class and we can actually use some of the methods that we have inside
this class.
If you want to actually know more about about this class.
But just see this class inside this inside the Adalbert documentation.
So collections has actually a method called shuffle.
And we can actually use this method in order to shovel to shuffle the actually the values that we have
inside the list.
So here as you can see we have actually all animals names list.
And because I don't want to make that queasy I don't want to make the Cooley's questions are predictable
and I don't want to be the questions to be in order.
I want the questions to be on order right so that the user can actually see different images or see
different animal images later when the squeeze is actually to reset or bent.
For example the use that is actually starting the quiz in.
Another time I want the questions to be on order.
You want to advance the animal image has to be on order.
So I want to actually shuffle the images that are inside of this list so collections that shuffle all
animals names list and that it's going to try to shuffle all the animals names these and it's going
to actually just make it up on an ordered list of animals.
And then in this way our quiz is actually more unpredictable.
So now that these are animals names this is actually shuffled.
Let's look at let's actually look at the other lines of code here.