OK.
So now inside of this main activity class I'm going to actually declare two objects.
So as you can see here these are the lines of code that they actually pasted here.
First of all I actually created an object of type linear layout and the name of this object is linearly
or horizontal.
And I actually created an object of type image view and the name of this object is IMT animal.
OK.
And inside of this uncreate Smurfette I want to actually to instantiate these objects that I actually
declared inside of this class.
OK.
So first of all I want to actually instantiate these linearly at horizontal.
So here I can just type in linearly or horizontal assignments.
Operator And here I need to cast this object to are linearly horizontal linearly out excuse me linearly
out and fight view by ID are that Id dot lenient lay out horizontal.
OK.
And now let's actually instantiate this.
I am animate object.
So here I can just say I am the animal assignment operator and then here I need to test this object
to an image view object.
OK.
Find a view by the artist.
I really thought all UMG anemone.
OK so now.
So now inside of our class I want to actually paste them on their feet here and then I'm going to explain
to you what's going on here.
So after the alien curly brace of these uncreate Meffert Let's actually create a method here.
And as you can see here this is the Meffert that I actually pasted here.
Public void and the name of this method is let's sit lay out palms for image.
So I just need to change this up here to our capital case letter.
OK.
So the access modifier of this method is public.
The return type of this method is void.
And as you can see the name of this method is let's set out perhaps for image view and this and if it
actually exits an object of type image view.
OK.
As you can see and here inside the Meffert I actually referred to this argument image view that sets
out perhaps Miyu linearly out so linear layouts as you can see the parent is a linear layout that lay
out arms.
Ok so here I want to specify the width and height of my image view.
So 1000 for the beat and one of 1000 for the height.
OK.
So here I'm going actually pasting 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 they actually pasted here.
OK.
So now when I should explain to you what this code does here.
OK.
First of all I created a for loop here.
OK.
And inside the Prentice's of this for loop as you can see I created a variable of type integer and the
name of this valuable is index.
And then I assigned a value 0 to this index variable.
This is actually a local value.
OK.
And here I specified the condition of which determines how many times this group is going to be executed.
So until the value of this index variable is less than the value of the length of these animal images
Ari that is inside of this animal class as you can see here.
Then this loop is going to be executed and after each execution of this for a loop the value of this
index variable is going to be incremented by 1.
So inside of this for loop.
First of all I created a constant.
OK.
And as you can see this is the keyboard final.
So this is a constant and the type of this constant is integer and the name of this constant is.
OK.
And then I assigned the value of this index a local variable to this or a constant here.
OK.
And here as you can see inside of this for loop as you can see I created an image view as you can see
here.
And then here I instantiated this image.
And then I specified the context in say the practices and then in line 40 I referred to this image here
data set image resource.
So here I want to actually output this image to this image view OK animal.
That animal images some index.
OK so it's going to actually site assign specific images that is inside of this specific index of these
and as you can see here are two these are image view.
OK.
And here we call this.
Let's set out perhaps for image view image view.
So here we are calling this Smurfette that we actually created inside this class.
So here we want to set the wheat and the height of this image view.
OK.
By calling this method.
So because this image is going to be inside the linearly out it is OK that as you can see here we actually
put this linearly out here today or tomorrow.
OK.
As you can see here in inside these are content on the alignment of the example here I need to click
on a clear cashier as you can see here inside this componentry.
This holds onto the scroll view.
It actually has a child called linearly out horizontally.
So our images are going to be inside these linearly or horizontal.
OK.
So the parent of those images is linearly out.
So that's why we actually put this really anyone else here.
Tattletales perhaps to specify the feet and the height of our image view.
Okay.
And here are I actually specify a padding some padding values for this image view 100 for the left 100
for the top 100 for the right and 100 for the bottom.
And here are I actually made this image.
You are a listener to the clicks of the user.
OK.
So image you are certainly close and her new view that unclick listener.
So here I actually created an anonymous in a class as you can see here that implements this article
class and an interface.
And it is actually implementing this method.
Ok this abstract method.
And here in say this uncle my faith I specify that every time the user clicks on this image view I enter
animal data set image resource.
So this animal is actually to go inside this content underline minute example.
This is our I am the animal.
OK.
So I and the animal that said Image resource as you can see here.
OK animal that animal images that are Suppe.
So that's why we actually created this constant insight this fall.
OK.
So if they actually referred to this index as you can see here we cannot actually do that here because
we are inside an inner class an anonymous inner class and we cannot actually refers to a variable that
is not final inside of an inner class.
And if I actually declare these are a local variable final Let's see what happens.
Now here it is showing us an error and it says cannot assign a value to final value of an index.
OK so if we cannot actually declare this index a valuable fine note.
OK.
So we actually created a constant inside this for a loop and the name of this constant is.
And then I assigned this index to this.
OK.
So here I referred to this here.
It's a constant so that we can actually get a specific image inside of these animal images array.
OK.
So then they use a click and a specific image that specific image is going to be assigned to this IMJ
animal image view.
OK.
And here we call this let's say out let's sit out perhaps for you again we call this our method here.
As you can see I am the animal.
OK.
It's going to actually sit out of set the image of your beach and the image of your height.
And here we created toast.
OK a toast that takes a make takes.
And here for the first argument finish to specify the context main activity that this he here for the
second argument.
This is this is actually a text that you want to actually to show to the user.
This is and this is the name of our enemy animal and animal that animal names.
OK.
So this is an array that you actually created inside this animal our class animal names.
OK.
And he called.
He actually declares this array as each.
OK.
All right.
OK I'll toast that Len for short.
So this is the duration of the text and we're calling this a show him effort on this MF at here and
now after this uncle listener.
Here we are actually adding this image view to this linearly out horizontal.
OK.
So inside this content underline minute example you have this linearly and what is on.
So if we are adding those images that is a linearly or horizontal until the actually the value of the
index value is less than the value of the length of these images array.
OK so now let's actually run our project and see what happens.
So as you can see here now our application is running on this emulator.
And he had as he had said these are our animal images inside the gallery.
Here you can see these images in say the gallery.
And here you have these are our animal images inside the horizontal scroll view.
So here as you can see if you scroll to the left now I can see these images here.
OK so for example if I actually click on this chat here now if I scroll down I can see the image of
this cat here.
OK.
And if you actually scroll to the left they can actually click on this.
Now here.
Now we can see the image of this tau and the TOSed that actually shows us that the text of the message.
And here if I click on this Dolfin you can see it says this is Dalfin and this is the image so let me
explain to you what's going on here.