1
00:00:00,270 --> 00:00:07,230
So as you can see here these are two lines of code that I pasted here and now and when I try to explain

2
00:00:07,230 --> 00:00:08,520
to you what's going on here.

3
00:00:08,520 --> 00:00:09,750
Exactly.

4
00:00:09,780 --> 00:00:14,360
So just look at this line of code here in line number one hundred and four here.

5
00:00:14,370 --> 00:00:18,670
As you can see private view that unclick listener.

6
00:00:18,780 --> 00:00:25,880
So as you can see I am actually creating a listener here and whenever they use it is actually for example.

7
00:00:26,040 --> 00:00:32,100
Let me show you the emulator and whenever they use it is actually touching these gifts buttons.

8
00:00:32,400 --> 00:00:35,460
This listener here is going to be actually called.

9
00:00:35,520 --> 00:00:36,030
OK.

10
00:00:36,150 --> 00:00:38,310
This block of code here is going to be called.

11
00:00:38,670 --> 00:00:45,710
And now as you can see between a good listener so view that unclick listener BT and guess listener right.

12
00:00:45,720 --> 00:00:51,270
So this isn't the name of our listener as you can see here via specified here that between guess that

13
00:00:51,270 --> 00:00:54,290
certain click listen it pity and gets a listener right.

14
00:00:54,360 --> 00:01:03,330
So now assignment operator new view that unclick listener and as you can see here we're actually creating

15
00:01:03,390 --> 00:01:09,750
an anonymous inner class and that anonymous inner class is actually conforming to these unclick listener

16
00:01:09,780 --> 00:01:11,480
interface as you can see here.

17
00:01:11,610 --> 00:01:18,640
And because of that conforming as you can see here we are I mean to actually provided Ismir method here.

18
00:01:18,690 --> 00:01:24,750
Unclick So this is actually an abstract method inside this unclick a listener interface.

19
00:01:24,880 --> 00:01:30,340
And because of that we need to actually provide an implementation for this method here.

20
00:01:30,450 --> 00:01:37,560
So whenever the user actually touches the Spartans as you can see here this anklet for the here is going

21
00:01:37,560 --> 00:01:38,690
to be executed.

22
00:01:38,970 --> 00:01:45,040
So inside is Uncle Mefford as you can see here we have a button.

23
00:01:45,120 --> 00:01:51,230
So I created about an object a button and the name is PTEN guess assignment operator.

24
00:01:51,570 --> 00:01:59,360
And here as you can see here this anklet if it actually accepts one argument and at the type of this

25
00:01:59,430 --> 00:02:02,350
argument is view as you can see here this is view.

26
00:02:02,520 --> 00:02:07,230
So as you can see here these buttons are actually subclasses of views.

27
00:02:07,230 --> 00:02:07,910
Right.

28
00:02:07,950 --> 00:02:14,280
So the view class is actually the superclass of the Button class and that's why you can actually refer

29
00:02:14,280 --> 00:02:20,910
to these buttons as views because there is actually an is a relationship between a button and a view

30
00:02:21,240 --> 00:02:23,340
a button is our view.

31
00:02:23,370 --> 00:02:29,750
Right because a button is actually a subclass of view so that you can see that the argument is after

32
00:02:29,820 --> 00:02:33,210
view and this view is going to be the spot.

33
00:02:33,210 --> 00:02:35,730
These buttons here right these arguments.

34
00:02:35,790 --> 00:02:42,230
So now I can actually cast this view to a button object as it did here.

35
00:02:42,510 --> 00:02:49,920
So inside Apprentice's first I actually put this button here and then I actually referred to this argument

36
00:02:49,920 --> 00:02:56,940
view so that as you can see here now we are actually assigning that view to this Pythian and just as

37
00:02:56,940 --> 00:03:02,880
it has here we are actually casting this view this argument a view to a button and then we are assigning

38
00:03:02,880 --> 00:03:05,080
that spot into an expedient guess.

39
00:03:05,250 --> 00:03:11,880
So now we have this button here between guess and in line one hundred and nine as you can see here we

40
00:03:11,880 --> 00:03:13,340
have a string by the U.

41
00:03:13,560 --> 00:03:16,830
And the name of our string value is guess value.

42
00:03:16,830 --> 00:03:21,370
So for example whenever they use it it's actually putting these buttons.

43
00:03:21,510 --> 00:03:29,670
So for example I touch despite an ant and now as you can see here when I touch this button here I want

44
00:03:29,670 --> 00:03:32,500
to get this the text of this button.

45
00:03:32,520 --> 00:03:34,460
I want to get that disvalue.

46
00:03:34,470 --> 00:03:39,860
So that's why I actually created a string value here guess value assignment operator.

47
00:03:40,050 --> 00:03:45,360
So are you referred to the name of the spot in PTEN gifts that get text to a string.

48
00:03:45,450 --> 00:03:50,850
So I can actually get the text of the spot in which is actually and and then as you can see I can convert

49
00:03:50,910 --> 00:03:57,520
that value to a string value and then assign that value to this guess value here in line number 110

50
00:03:57,540 --> 00:04:00,560
as you can see here we have another stunning value.

51
00:04:00,750 --> 00:04:04,560
So streambed and set a value as you can see here.

52
00:04:04,620 --> 00:04:11,280
Assignment operator and then as it has here I am actually referring to one of the effects that you are

53
00:04:11,280 --> 00:04:15,410
going to create inside this file inside this main activity fragment class.

54
00:04:15,620 --> 00:04:21,100
But you haven't still actually created this method yet but you're going to create it later in our code.

55
00:04:21,270 --> 00:04:25,140
But for now just write this code here as this name.

56
00:04:25,140 --> 00:04:27,320
Get the exact animal name.

57
00:04:27,480 --> 00:04:28,140
OK.

58
00:04:28,410 --> 00:04:33,720
And now as you can see I actually created our strange valuable and set value in order to actually get

59
00:04:33,770 --> 00:04:37,780
the correct answer from our images.

60
00:04:38,250 --> 00:04:44,970
And here I actually create I need to create a method get the exact animal name so that we get the exact

61
00:04:45,000 --> 00:04:48,330
animal name and then we can actually specify the correct answer.

62
00:04:48,460 --> 00:04:52,430
When I actually create the Smurfette you will see that how this method works.

63
00:04:52,470 --> 00:04:58,700
But for now I just write this method here and this if it accepts one argument correct.

64
00:04:58,730 --> 00:05:00,580
Animals answer right.

65
00:05:00,590 --> 00:05:06,500
So as you can see here are these correct animals and that is actually declared inside our class.

66
00:05:06,530 --> 00:05:12,310
If we actually scroll to the top here as you can see if you actually are declared this a correct animal.

67
00:05:12,320 --> 00:05:16,620
And so as you can see here in line number 39 which is a stream.

68
00:05:16,880 --> 00:05:17,360
Right.

69
00:05:17,360 --> 00:05:22,070
So this variable is going to hold the correct animal answer.

70
00:05:22,460 --> 00:05:29,050
And that's why we actually declared this variable here so that we can actually use it whenever we want.

71
00:05:29,060 --> 00:05:34,070
So if you scroll down here and if you're going to say this and click my head of when I actually use

72
00:05:34,070 --> 00:05:41,440
this method and if I pass this value the correct answer to this method is if it is going to do something

73
00:05:41,440 --> 00:05:46,670
with that value and then it's going to return a string value and then we can actually assign that right

74
00:05:46,700 --> 00:05:48,990
hand string value to the answer value.

75
00:05:50,120 --> 00:05:56,480
And here as you can see now we have this answer rather you and Enloe number one hundred and eleven.

76
00:05:56,510 --> 00:05:58,950
If they use that I said Actually guesses right.

77
00:05:58,980 --> 00:06:04,370
If you touch it to use that I should touch is the correct animal name for example here we have a sheep.

78
00:06:04,670 --> 00:06:12,170
And if I had touched the value here as you can see here it says right and now it's actually created

79
00:06:12,380 --> 00:06:16,960
an if statement and it says if guests value if they use it.

80
00:06:16,970 --> 00:06:23,480
For example if they use those guess value as you can see here just value that equals answer value.

81
00:06:23,720 --> 00:06:29,300
So if they use them for example purchased the right animal name as you can see here for example my guess

82
00:06:29,330 --> 00:06:29,940
is lion.

83
00:06:29,990 --> 00:06:31,010
Right.

84
00:06:31,010 --> 00:06:37,760
And if this value is equal to answer value as you can see here for example here it says.

85
00:06:37,760 --> 00:06:38,780
Right.

86
00:06:38,870 --> 00:06:43,850
So it's going to actually go inside the curly braces of this if statement here and it's going to to

87
00:06:43,850 --> 00:06:47,010
execute these lines of code here inside this IIF statement.

88
00:06:47,210 --> 00:06:51,760
So let's actually go inside this if statement and let's see what's going on here.

89
00:06:51,770 --> 00:06:57,470
So first of all we want to actually increment as you can see here in line number one hundred and eleven.

90
00:06:57,470 --> 00:07:00,380
I am actually incrementing the number of all guesses.

91
00:07:00,560 --> 00:07:04,060
So whenever the user is actually touching one of these guesses one of this gives.

92
00:07:04,070 --> 00:07:10,580
But guess partons is going to actually increment the number of our guesses valuable so let's actually

93
00:07:10,580 --> 00:07:12,720
scroll to the top here.

94
00:07:13,010 --> 00:07:14,310
Let's scroll to the top.

95
00:07:14,570 --> 00:07:21,260
And as you can see in line number 14 of you actually created this valuable we declared this valuable

96
00:07:21,260 --> 00:07:23,790
which is the integer number of all guesses.

97
00:07:24,050 --> 00:07:32,120
So this variable is going to hold the number of all the cases that use it as is actually making of throughout

98
00:07:32,120 --> 00:07:33,450
the entire quiz.

99
00:07:33,620 --> 00:07:40,000
So we can actually get the exact value of number of guesses that the user has made.

100
00:07:40,010 --> 00:07:42,090
So let's actually scroll down here.

101
00:07:42,290 --> 00:07:45,870
And whenever you do that for example touches one of these buttons.

102
00:07:45,920 --> 00:07:47,820
We're going to increment that number of.

103
00:07:47,820 --> 00:07:50,180
All guesses are valuable.

104
00:07:50,600 --> 00:07:56,480
And here if the user actually gets the right animal as you can see here if there's value that equals

105
00:07:56,520 --> 00:08:01,180
and sort of value plus plus number of right answers.

106
00:08:01,190 --> 00:08:07,610
So for example if I actually touch here code as you can see here it's going I should increment the number

107
00:08:07,610 --> 00:08:09,590
of right answers right there.

108
00:08:09,680 --> 00:08:13,350
So we actually declared this valuable here inside our class again.

109
00:08:13,370 --> 00:08:15,630
As you can see here number of right answers.

110
00:08:15,740 --> 00:08:22,030
So this rally is going to hold the number of right answers that the user actually guessed right.

111
00:08:22,040 --> 00:08:23,990
For example here we have a leopard.

112
00:08:24,050 --> 00:08:28,670
And if I touch Lippard it's going to increment the value of this number of right answers about the table

113
00:08:28,790 --> 00:08:29,990
which is of type integer.

114
00:08:30,080 --> 00:08:31,150
Right.

115
00:08:31,160 --> 00:08:33,260
So now let's actually scroll down here.

116
00:08:34,320 --> 00:08:37,760
So first is going to increment the number of right answers.

117
00:08:37,800 --> 00:08:44,550
And then in line number one hundred and eighteen we're going to actually set a text to this RTX the

118
00:08:44,550 --> 00:08:46,970
answer takes you so takes the answer.

119
00:08:47,010 --> 00:08:53,130
That's a text first we want to actually get the animal name and Sarratt you.

120
00:08:53,130 --> 00:08:55,330
So for example here we have a bird.

121
00:08:55,570 --> 00:09:00,110
And the answer value is actually the exact animal name that they use or touch.

122
00:09:00,150 --> 00:09:00,600
Right.

123
00:09:00,750 --> 00:09:05,030
So the answer that it takes answer ready for example for example.

124
00:09:05,030 --> 00:09:08,810
Here we have a beer plus an exclamation mark.

125
00:09:08,940 --> 00:09:13,980
Plus as you can see here inside the double quotes space right.

126
00:09:13,980 --> 00:09:18,250
So now here we have a bare bare exclamation mark space.

127
00:09:18,270 --> 00:09:22,250
Right here we have a shark as you can see here.

128
00:09:22,420 --> 00:09:24,960
Shark exclamation mark right.

129
00:09:26,440 --> 00:09:28,730
So hopefully that makes sense.

130
00:09:29,050 --> 00:09:35,620
And here as you can see whenever the user touches the the actually the right animal name the truly my

131
00:09:35,620 --> 00:09:41,380
name we want the other all the actually gets patents to be disabled.

132
00:09:41,530 --> 00:09:42,010
Right.

133
00:09:42,010 --> 00:09:47,650
For example here we have a peacock and a peacock on because I can't actually touch the other animals

134
00:09:47,650 --> 00:09:48,350
here right.

135
00:09:48,550 --> 00:09:56,440
Or if I actually for example here we have a fox and if I touch Fox here I cannot actually click on the

136
00:09:56,680 --> 00:09:57,510
buttons here.

137
00:09:57,580 --> 00:10:00,640
And all these other buttons are going to be disabled.

138
00:10:00,910 --> 00:10:03,200
If I actually touch the right animal.

139
00:10:03,370 --> 00:10:08,830
So as you can see here we will need to create another method inside our class this able cuius gets buttons

140
00:10:08,920 --> 00:10:14,570
in order to actually disable in order to disable all the buttons of our quiz.

141
00:10:14,740 --> 00:10:21,520
And as you can see here we have another statement here and here it says If number of the right answers

142
00:10:22,060 --> 00:10:25,600
is equal to number of animals included in quiz.

143
00:10:25,720 --> 00:10:27,340
So what does this mean.

144
00:10:27,340 --> 00:10:29,390
So now let me actually scroll to the top here.

145
00:10:29,410 --> 00:10:34,820
As you can see here are this constant number of animals included in Cooley's is 10 right.

146
00:10:34,840 --> 00:10:38,410
And this means that we're going to have 10 animals 10.

147
00:10:38,410 --> 00:10:45,520
A question is actually inside our quiz and here let's scroll down here.

148
00:10:45,850 --> 00:10:54,070
As you can see here it says if number of right answers for example let me actually for example click

149
00:10:54,070 --> 00:10:58,090
on Parad here and here it is buried exclamation mark.

150
00:10:58,120 --> 00:10:59,200
Right.

151
00:10:59,200 --> 00:11:01,680
And now let me click on Pinguin.

152
00:11:02,080 --> 00:11:05,670
And now as you can see here it's going to show us a dialog.

153
00:11:05,830 --> 00:11:11,990
And it is Ilive a number of guesses and ninety point ninety one percent correct.

154
00:11:12,460 --> 00:11:13,360
So what does this mean.

155
00:11:13,360 --> 00:11:20,680
This means that if for example the user the user actually guesses all the animals right.

156
00:11:21,160 --> 00:11:25,030
And for example my first guess is the right animal.

157
00:11:25,030 --> 00:11:26,920
And let me reset the animal quiz.

158
00:11:27,120 --> 00:11:29,520
And for example my first guess is shark.

159
00:11:29,530 --> 00:11:30,810
This is my first guess.

160
00:11:30,970 --> 00:11:34,710
And this animal one of 10 white shark.

161
00:11:34,950 --> 00:11:37,170
This is one guess.

162
00:11:37,180 --> 00:11:39,710
And here for example here we have flappy bird.

163
00:11:39,770 --> 00:11:41,060
So flappy bird.

164
00:11:41,380 --> 00:11:43,460
This is our second guess.

165
00:11:43,630 --> 00:11:45,080
And that was right.

166
00:11:45,190 --> 00:11:46,710
And here we have a dog.

167
00:11:46,720 --> 00:11:49,800
So Dog this is our first guess and this is right.

168
00:11:49,810 --> 00:11:50,430
Right.

169
00:11:50,440 --> 00:11:53,730
So as you can see here this is question number four of 10.

170
00:11:54,010 --> 00:11:56,360
And now here we have a penguin.

171
00:11:56,380 --> 00:12:01,070
This is our fourth guess here we have a chance.

172
00:12:01,090 --> 00:12:02,780
This is our five guess.

173
00:12:02,800 --> 00:12:07,490
Actually this is our fifth test and here this is a fish.

174
00:12:07,490 --> 00:12:09,520
This is animal sex of 10 right.

175
00:12:09,520 --> 00:12:13,930
So now I can actually for example choose fish.

176
00:12:14,390 --> 00:12:17,390
This is our six actually guess.

177
00:12:17,610 --> 00:12:21,390
And here we have a crocodile.

178
00:12:21,390 --> 00:12:27,220
This is our Sibneft is here we have a fox.

179
00:12:27,410 --> 00:12:29,650
This is our eight guests.

180
00:12:29,900 --> 00:12:31,670
Here we have a snake.

181
00:12:32,210 --> 00:12:33,330
As you can see here.

182
00:12:33,380 --> 00:12:38,150
So this is our 9:00 guess as you can see.

183
00:12:38,310 --> 00:12:40,910
And here we have a peacock.

184
00:12:41,040 --> 00:12:41,920
This is our tent.

185
00:12:41,940 --> 00:12:42,110
Yes.

186
00:12:42,120 --> 00:12:44,600
And here it says 10 number of guesses right.

187
00:12:44,610 --> 00:12:51,170
So we just are 10 numbers as you can see here 10 10 times and all of the guess says what.

188
00:12:51,300 --> 00:12:52,580
Well actually correct.

189
00:12:52,800 --> 00:12:56,600
And now it says and 100 percent correct.

190
00:12:56,610 --> 00:12:57,160
Right.

191
00:12:57,390 --> 00:13:00,040
So if number of right answers.

192
00:13:00,080 --> 00:13:00,400
OK.

193
00:13:00,430 --> 00:13:06,510
The number of actually this variable holds the number of times that you actually guess are the animal

194
00:13:06,510 --> 00:13:07,170
names.

195
00:13:07,260 --> 00:13:13,860
So if number of right answers if the number of times that you actually touched the animal names of you

196
00:13:13,860 --> 00:13:17,290
actually guessed the animal name correct.

197
00:13:17,340 --> 00:13:24,090
As you can see here is equal to a number of animals included increased dialogue fragments so this can

198
00:13:24,090 --> 00:13:29,790
actually create a dialect fragment here and it's going to show us our dialogue.

199
00:13:29,790 --> 00:13:31,460
So this is our dialogue.

200
00:13:32,120 --> 00:13:39,630
Animalcules results so this is the name of the actually daylight assignment operator new dialogue fragment.

