So as you can see here these are two lines of code that I pasted here and now and when I try to explain
to you what's going on here.
Exactly.
So just look at this line of code here in line number one hundred and four here.
As you can see private view that unclick listener.
So as you can see I am actually creating a listener here and whenever they use it is actually for example.
Let me show you the emulator and whenever they use it is actually touching these gifts buttons.
This listener here is going to be actually called.
OK.
This block of code here is going to be called.
And now as you can see between a good listener so view that unclick listener BT and guess listener right.
So this isn't the name of our listener as you can see here via specified here that between guess that
certain click listen it pity and gets a listener right.
So now assignment operator new view that unclick listener and as you can see here we're actually creating
an anonymous inner class and that anonymous inner class is actually conforming to these unclick listener
interface as you can see here.
And because of that conforming as you can see here we are I mean to actually provided Ismir method here.
Unclick So this is actually an abstract method inside this unclick a listener interface.
And because of that we need to actually provide an implementation for this method here.
So whenever the user actually touches the Spartans as you can see here this anklet for the here is going
to be executed.
So inside is Uncle Mefford as you can see here we have a button.
So I created about an object a button and the name is PTEN guess assignment operator.
And here as you can see here this anklet if it actually accepts one argument and at the type of this
argument is view as you can see here this is view.
So as you can see here these buttons are actually subclasses of views.
Right.
So the view class is actually the superclass of the Button class and that's why you can actually refer
to these buttons as views because there is actually an is a relationship between a button and a view
a button is our view.
Right because a button is actually a subclass of view so that you can see that the argument is after
view and this view is going to be the spot.
These buttons here right these arguments.
So now I can actually cast this view to a button object as it did here.
So inside Apprentice's first I actually put this button here and then I actually referred to this argument
view so that as you can see here now we are actually assigning that view to this Pythian and just as
it has here we are actually casting this view this argument a view to a button and then we are assigning
that spot into an expedient guess.
So now we have this button here between guess and in line one hundred and nine as you can see here we
have a string by the U.
And the name of our string value is guess value.
So for example whenever they use it it's actually putting these buttons.
So for example I touch despite an ant and now as you can see here when I touch this button here I want
to get this the text of this button.
I want to get that disvalue.
So that's why I actually created a string value here guess value assignment operator.
So are you referred to the name of the spot in PTEN gifts that get text to a string.
So I can actually get the text of the spot in which is actually and and then as you can see I can convert
that value to a string value and then assign that value to this guess value here in line number 110
as you can see here we have another stunning value.
So streambed and set a value as you can see here.
Assignment operator and then as it has here I am actually referring to one of the effects that you are
going to create inside this file inside this main activity fragment class.
But you haven't still actually created this method yet but you're going to create it later in our code.
But for now just write this code here as this name.
Get the exact animal name.
OK.
And now as you can see I actually created our strange valuable and set value in order to actually get
the correct answer from our images.
And here I actually create I need to create a method get the exact animal name so that we get the exact
animal name and then we can actually specify the correct answer.
When I actually create the Smurfette you will see that how this method works.
But for now I just write this method here and this if it accepts one argument correct.
Animals answer right.
So as you can see here are these correct animals and that is actually declared inside our class.
If we actually scroll to the top here as you can see if you actually are declared this a correct animal.
And so as you can see here in line number 39 which is a stream.
Right.
So this variable is going to hold the correct animal answer.
And that's why we actually declared this variable here so that we can actually use it whenever we want.
So if you scroll down here and if you're going to say this and click my head of when I actually use
this method and if I pass this value the correct answer to this method is if it is going to do something
with that value and then it's going to return a string value and then we can actually assign that right
hand string value to the answer value.
And here as you can see now we have this answer rather you and Enloe number one hundred and eleven.
If they use that I said Actually guesses right.
If you touch it to use that I should touch is the correct animal name for example here we have a sheep.
And if I had touched the value here as you can see here it says right and now it's actually created
an if statement and it says if guests value if they use it.
For example if they use those guess value as you can see here just value that equals answer value.
So if they use them for example purchased the right animal name as you can see here for example my guess
is lion.
Right.
And if this value is equal to answer value as you can see here for example here it says.
Right.
So it's going to actually go inside the curly braces of this if statement here and it's going to to
execute these lines of code here inside this IIF statement.
So let's actually go inside this if statement and let's see what's going on here.
So first of all we want to actually increment as you can see here in line number one hundred and eleven.
I am actually incrementing the number of all guesses.
So whenever the user is actually touching one of these guesses one of this gives.
But guess partons is going to actually increment the number of our guesses valuable so let's actually
scroll to the top here.
Let's scroll to the top.
And as you can see in line number 14 of you actually created this valuable we declared this valuable
which is the integer number of all guesses.
So this variable is going to hold the number of all the cases that use it as is actually making of throughout
the entire quiz.
So we can actually get the exact value of number of guesses that the user has made.
So let's actually scroll down here.
And whenever you do that for example touches one of these buttons.
We're going to increment that number of.
All guesses are valuable.
And here if the user actually gets the right animal as you can see here if there's value that equals
and sort of value plus plus number of right answers.
So for example if I actually touch here code as you can see here it's going I should increment the number
of right answers right there.
So we actually declared this valuable here inside our class again.
As you can see here number of right answers.
So this rally is going to hold the number of right answers that the user actually guessed right.
For example here we have a leopard.
And if I touch Lippard it's going to increment the value of this number of right answers about the table
which is of type integer.
Right.
So now let's actually scroll down here.
So first is going to increment the number of right answers.
And then in line number one hundred and eighteen we're going to actually set a text to this RTX the
answer takes you so takes the answer.
That's a text first we want to actually get the animal name and Sarratt you.
So for example here we have a bird.
And the answer value is actually the exact animal name that they use or touch.
Right.
So the answer that it takes answer ready for example for example.
Here we have a beer plus an exclamation mark.
Plus as you can see here inside the double quotes space right.
So now here we have a bare bare exclamation mark space.
Right here we have a shark as you can see here.
Shark exclamation mark right.
So hopefully that makes sense.
And here as you can see whenever the user touches the the actually the right animal name the truly my
name we want the other all the actually gets patents to be disabled.
Right.
For example here we have a peacock and a peacock on because I can't actually touch the other animals
here right.
Or if I actually for example here we have a fox and if I touch Fox here I cannot actually click on the
buttons here.
And all these other buttons are going to be disabled.
If I actually touch the right animal.
So as you can see here we will need to create another method inside our class this able cuius gets buttons
in order to actually disable in order to disable all the buttons of our quiz.
And as you can see here we have another statement here and here it says If number of the right answers
is equal to number of animals included in quiz.
So what does this mean.
So now let me actually scroll to the top here.
As you can see here are this constant number of animals included in Cooley's is 10 right.
And this means that we're going to have 10 animals 10.
A question is actually inside our quiz and here let's scroll down here.
As you can see here it says if number of right answers for example let me actually for example click
on Parad here and here it is buried exclamation mark.
Right.
And now let me click on Pinguin.
And now as you can see here it's going to show us a dialog.
And it is Ilive a number of guesses and ninety point ninety one percent correct.
So what does this mean.
This means that if for example the user the user actually guesses all the animals right.
And for example my first guess is the right animal.
And let me reset the animal quiz.
And for example my first guess is shark.
This is my first guess.
And this animal one of 10 white shark.
This is one guess.
And here for example here we have flappy bird.
So flappy bird.
This is our second guess.
And that was right.
And here we have a dog.
So Dog this is our first guess and this is right.
Right.
So as you can see here this is question number four of 10.
And now here we have a penguin.
This is our fourth guess here we have a chance.
This is our five guess.
Actually this is our fifth test and here this is a fish.
This is animal sex of 10 right.
So now I can actually for example choose fish.
This is our six actually guess.
And here we have a crocodile.
This is our Sibneft is here we have a fox.
This is our eight guests.
Here we have a snake.
As you can see here.
So this is our 9:00 guess as you can see.
And here we have a peacock.
This is our tent.
Yes.
And here it says 10 number of guesses right.
So we just are 10 numbers as you can see here 10 10 times and all of the guess says what.
Well actually correct.
And now it says and 100 percent correct.
Right.
So if number of right answers.
OK.
The number of actually this variable holds the number of times that you actually guess are the animal
names.
So if number of right answers if the number of times that you actually touched the animal names of you
actually guessed the animal name correct.
As you can see here is equal to a number of animals included increased dialogue fragments so this can
actually create a dialect fragment here and it's going to show us our dialogue.
So this is our dialogue.
Animalcules results so this is the name of the actually daylight assignment operator new dialogue fragment.