So here let's actually go back and say discrete beauty at the java file here.
Now I'm going actually pasting some lines of code 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.
So first of all I created an array of integer values as you can see here the name of this art is animate
images.
So here I am actually referring to the ID of my image inside these tribal Forder as you can see inside
our project we have this tribal folder.
So I just referred to the idea of these images as you can see are that triable that bear and the other
images and you have an arrow of string values as you can see here.
So here I actually signed the name of odd animals to this Aure animal names.
OK.
So now let's actually create a context.
OK so context context.
So here I just want to declare this context object and noun texturally create a constructor for this
great view adapter class so I can just type in public view adapter.
So the name of your constructor must be the same as the name of your class.
OK.
And then I need to specify that this constructor actually that accepts an object of type context.
So here I can just type in context context and then here in say that these constructor can actually
initialize these are context objects that are actually declared in line 20.
So here I can just type in this that context assignment operator context.
OK so this context as you can see refers to this instance valuable.
And this context refers to this argument.
OK so now let's actually put in our own implementations inside of these other methods.
So the first effort is good.
Count OK as you can see if it is public the return type of this method is int integer so these Minford
on it's to return a value of type integer and the name of this if it is get count.
So we need to actually return the number of elements that are inside of these for example animal images.
Ari.
OK.
So here I could just return animal images that land.
OK.
And we have here this.
I get either Mefford and this get item if it returns an object.
OK.
So here as you can see it is if it actually accepts an argument of type integer position.
So is this method actually gives us this position the position about items inside of the array.
So here I need to actually to return.
Are there specific values that are for example in say that these animal images.
OK the specific images that are inside of this specific indexes of these Ari OK.
So here in the inside These are get item if I could just 310 these animal images stop position.
So as you can see here we received the position of our animals as an argument.
So we receive the position or the index of our animals inside of these animal images as an argument
to the Smurfit as you can see here.
So here we have this get item ID.
OK so the idea of identity as you can see we receive the index or the position of our values inside
of our arrays.
As you can see for example this animal images are a reason for this value is at index 0.
OK so this would be the ID of our items.
So here I could just return this position as an ID.
OK.
Item ID.
And here we need to actually implement this method.
So it's actually did it this line of code here and here we could actually are putting in our own implementations
inside of this Moffit.
So this is really important.
And this it is going to be called on every iteration of our values.
Inside there are actually the great view.
OK.
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 inside of this method.
So first about in line 50 I actually created an object of type image view.
OK.
And the name of this image is I give you assignment operator and here I am actually instantiating this
object by putting this new keyword image view.
And for the context of this image view class I need to put in this context here.
OK this is required an in line 51.
I actually want to set the image for this image view so IMJ view that seems set image resource.
I want to actually return the image to this MFL.
So I just need to refer to the name of these animal images Arrey as you can see here we have these images
and animal images supposition.
OK so we actually received the position of our animals inside of this Ali an argument to these kids
view Meffert OK animal images supposition.
OK.
So it's going to actually assigned those images to this image of you here and you have this line of
code here.
I can give you that set the layout Department.
So the layout part is actually going to specify the weight and the height of our image views inside
of great view.
As you can see here inside these inside these emulator we can see this great view here and you can see
that the width and height of these image views inside of this great view.
OK.
So here I just inside the Prentice's I put in the new keyboard.
Great view.
So because these images are actually inside of the screen view first when it was actually the to the
name of the parents.
OK.
So the great view is the parent of these images.
OK.
So first I need to refer to the name of this parent or great view.
Ok thought lay out perhaps and then I can actually specify the width and height of my images.
OK.
So this is very important.
And here we have this.
I interviewed that said the padding.
So this is the padding of our images inside of this great view.
OK.
Ten for the left 10 for the top 10 for the right and 10 for the bottom and in line are 54 as you can
see I am specifying the scale type of my image view.
I give you that set scale type image view that said scale type that center crop as you can see here
this image views are actually at the center cropped as you can see here inside of this great view.
And you can actually specify other values too.
OK.
So for example I could just delete this value here and I can just typing image view that SKAIFE type
that.
And here you can specify these values.
For example feats x y.
OK.
And here I actually make these I am making this up.
I m g view object a listener to the clicks of the user.
OK so I can give you as you can see here that sets unclick listener.
OK I interviewed that said Uncle listener.
And as you can see here I am creating an anonymous in a class here.
OK.
Inside of this method inside of it inside of these gates view Meffert.
And here I created a toast.
OK toast that make text first I need to specify the context.
OK.
And then second I need to specify the text that I want to show to the user.
OK the name of the animal is animal image.
Animal names.
So here I referred to these animal names.
Ari as you can see these are a holds are the names of my animals.
Ok animals supposition.
So as you can see if we received the position of our animals as an argument here as you can see.
And here I am specifying the duration of my toast.
OK.
Toss that dotted line short.
And here I am calling them if it's show on this toast.
OK.
So here as you can see it's showing us an error and it says that because we are actually inside of an
inner class and anonymous in a class the this our position valuable disposition argument needs to be
final.
OK.
Valuable position is accessed from within in class needs to be declared final.
So here I could just put in the final keyword here and now as you can see the error is gone.
OK so here I am actually returning this item do you object.
So because this method actually returns an object of type review.
OK we could an image is actually a subclass of view.
We can actually return I interview.
OK.
So here you can see these arguments.
Position view and view group.
So let's actually change the name of this view argument to view here.
OK.
So I think that's enough for this class structure actually to go back and say this main activity of
a file.
And then here let's actually create an object from this great view adapter.
So here I can just type in great view adapter adapter assignment operator new and here again I need
to refer to the name of this great view adapter class.
And here for the constructor of this class I need to specify the context.
So the context is main activity that this.
OK semicolon.
OK the name of this class is the const is the context.
OK.
And here I need to refer to the name of discrete view here as you can see.
So g r the view that sets adapter.
OK.
And here we need to put in the adapter adapter.
OK.
So let's actually run on our project and see what happens.
So here as you can see our application is running on this emulator and this is that takes.
These are the images of our animals in a great view.
And here at the bottom you can see this great view here.
OK.
You can see these images.
And if I click on this image for example it says the name of the animal is bird and if you click on
these fish here the name of the animal is fish or for example this lion the name of the animal is lion
and tiger the name of the animal is Tiger.
So hopefully that makes sense.
And I think that's enough for this theater.
And 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.
Tauriel.