1
00:00:00,360 --> 00:00:06,090
So now let's actually look at these lines of code here in line number two hundred and twenty nine as

2
00:00:06,090 --> 00:00:07,100
you can see here.

3
00:00:07,170 --> 00:00:12,120
I actually referred to the name of this variable number of right answers.

4
00:00:12,120 --> 00:00:13,780
Assignment operator zero.

5
00:00:14,040 --> 00:00:17,840
So when I want to actually reset our quiz application.

6
00:00:17,960 --> 00:00:23,250
I want to actually assign the value zero for the number of right answers because in that case we are

7
00:00:23,250 --> 00:00:26,640
not going to have right answers because our application.

8
00:00:26,790 --> 00:00:29,160
Actually our quiz is actually reset.

9
00:00:29,160 --> 00:00:33,560
So again we have this number of all guesses valuable.

10
00:00:33,660 --> 00:00:39,300
And again we assign the values zero to the number of all guesses variable because again we are actually

11
00:00:39,330 --> 00:00:41,300
resetting our cuius application.

12
00:00:41,460 --> 00:00:45,090
So we want to assign the value zero to these variables.

13
00:00:45,210 --> 00:00:50,460
And if you actually scroll to the top here as you can see if you actually declare these two variables

14
00:00:50,460 --> 00:00:51,130
here.

15
00:00:51,130 --> 00:00:55,400
Number 45 I declare this variable here a number of all guesses.

16
00:00:55,440 --> 00:00:58,850
And we also declare this valuable number of right answers.

17
00:00:58,920 --> 00:01:03,360
So this number of all this is is going to actually hold or the number of times that the user actually

18
00:01:03,360 --> 00:01:06,360
guessed there actually questions.

19
00:01:06,360 --> 00:01:11,670
And this number of answers is going to actually hold the number of times that the use guessed at the

20
00:01:11,670 --> 00:01:12,820
right animal.

21
00:01:13,040 --> 00:01:13,690
OK.

22
00:01:13,890 --> 00:01:15,110
Just at the right.

23
00:01:15,120 --> 00:01:17,120
Just the name of the animal right.

24
00:01:17,160 --> 00:01:19,370
So hopefully that makes sense.

25
00:01:19,380 --> 00:01:21,160
And now the texturally scroll down.

26
00:01:21,210 --> 00:01:27,720
And let's actually go inside this actually inside this recent animal quis Smurfette.

27
00:01:27,840 --> 00:01:32,190
And here we have these animals names cuius list.

28
00:01:32,310 --> 00:01:40,340
So we have this Actually we have this arii But this is actually a list that can actually accept an array.

29
00:01:40,350 --> 00:01:47,580
And again lists are actually interfaces in Java and we use the least because we want to actually use

30
00:01:47,580 --> 00:01:50,670
the extra features that come with the list interface.

31
00:01:50,880 --> 00:01:59,700
So now if we actually scroll to the top here as you can see we actually declared these animals names

32
00:01:59,700 --> 00:02:01,910
quiz list here as you can see.

33
00:02:02,070 --> 00:02:09,960
So this variable is going to actually hold the number of actually the animals that we have inside our

34
00:02:09,960 --> 00:02:10,520
quiz.

35
00:02:10,650 --> 00:02:17,010
So now if I show you the emulator here as you can see let me actually show you the queries as you can

36
00:02:17,010 --> 00:02:17,370
see.

37
00:02:17,430 --> 00:02:20,420
We have we are going to have 10 questions right.

38
00:02:20,430 --> 00:02:27,740
So this means that we are going to have 10 randomly selected animal images from our project.

39
00:02:27,870 --> 00:02:30,630
And then it's going to actually show us those images to us.

40
00:02:30,870 --> 00:02:37,220
So if we have two variables to list actually the first one is all animals names list.

41
00:02:37,260 --> 00:02:40,550
And the second one is animals names quiz list.

42
00:02:40,590 --> 00:02:42,300
So this all animals names list.

43
00:02:42,300 --> 00:02:47,670
So for example let me show you the emulator if I actually go inside these settings activity and then

44
00:02:47,700 --> 00:02:54,120
here anemones as you can see if they use that actually specifies that he or she maybe wants to for example

45
00:02:54,780 --> 00:02:57,680
only have paint animals sight our quiz.

46
00:02:57,840 --> 00:03:04,800
Then in that case if they use that actually selects this tame animals here then the animal images inside

47
00:03:04,800 --> 00:03:09,490
the inside the actually came Underland animals fall there.

48
00:03:09,490 --> 00:03:14,110
So now let me show you the structure of the project inside it is tame Underland animals folder.

49
00:03:14,160 --> 00:03:18,590
These images are going to be actually assigned to these and all animals names list.

50
00:03:18,600 --> 00:03:19,210
OK.

51
00:03:19,590 --> 00:03:25,430
Or if they use that actually to select both of these checkboxes here this means that the user wants

52
00:03:25,440 --> 00:03:30,280
to have all the images that are inside of these folders.

53
00:03:30,270 --> 00:03:32,100
Wild animals and tame animals.

54
00:03:32,130 --> 00:03:38,380
So in that case that means that all these images are going to be assigned to these other animals names.

55
00:03:38,580 --> 00:03:46,220
So I showed you here inside these actually let me show you this method here.

56
00:03:46,240 --> 00:03:49,890
We said animal Chris as you can see inside is for a loop.

57
00:03:49,950 --> 00:03:57,090
He actually said that we want to add all the images all the image paths that we have inside our animal

58
00:03:57,090 --> 00:03:57,990
types inquiries.

59
00:03:57,990 --> 00:04:02,080
So here you are specifying the animal types that we want to put inside our quiz.

60
00:04:02,100 --> 00:04:02,880
Right.

61
00:04:02,880 --> 00:04:07,800
So in that case it's going to actually assign all the image paths to art at all.

62
00:04:07,800 --> 00:04:14,310
Animals are actually all animals names list so that all animals names these are going to is going to

63
00:04:14,420 --> 00:04:17,220
actually hold those image paths.

64
00:04:17,370 --> 00:04:20,370
But we have these animals names these.

65
00:04:20,400 --> 00:04:28,590
So this malleable this list is going to hold only the selected only randomly selected images that we

66
00:04:28,590 --> 00:04:30,410
have inside our quiz.

67
00:04:30,420 --> 00:04:34,200
So for example as you can see we have 10 only 10 questions right.

68
00:04:34,200 --> 00:04:41,490
We have lots of images but we are going to have only 10 questions and this means that if you want to

69
00:04:41,490 --> 00:04:47,640
actually use these images if you want to only have 10 questions in site Ahlquist we need to actually

70
00:04:47,640 --> 00:04:53,530
randomly select our 10 images from these folders and then we can actually put put that here.

71
00:04:53,670 --> 00:05:00,860
So these animals names quiz list right Ebell this list is going to hold that randomly that images those

72
00:05:01,030 --> 00:05:02,860
randomly selected images.

73
00:05:03,160 --> 00:05:04,900
So hopefully that makes sense.

74
00:05:04,900 --> 00:05:10,300
And now let me I actually double click on this tab here main activity Fleischman that Java tab and now

75
00:05:10,300 --> 00:05:15,850
let's actually scroll down here and again let's actually go inside this reset animalcules Mefford.

76
00:05:16,090 --> 00:05:21,880
So as you can see here because we want to actually do reset our animal quiz we need to actually clear

77
00:05:21,940 --> 00:05:26,080
all the values all the images that are inside of these animals names.

78
00:05:26,110 --> 00:05:27,810
Is this here first.

79
00:05:28,030 --> 00:05:32,930
And then here as you can see in line number two hundred and fifty three I created over the table which

80
00:05:32,930 --> 00:05:35,270
is of type integer and the name is counter.

81
00:05:35,440 --> 00:05:42,280
And then initially I assigned to devalue number one to this counter in line number 254 as you can see

82
00:05:42,280 --> 00:05:48,440
here we created another variable and the name of this variable is number of available animals.

83
00:05:48,580 --> 00:05:49,090
OK.

84
00:05:49,180 --> 00:05:51,660
Number of available animals.

85
00:05:51,760 --> 00:05:59,350
And this means that this variable here is going to actually hold all the number of animals that are

86
00:05:59,410 --> 00:06:01,900
actually available to to the queen.

87
00:06:01,900 --> 00:06:04,660
So for example Now let me show you the emulator.

88
00:06:04,810 --> 00:06:09,550
And now I want to actually go inside the settings activity and now I choose these animals.

89
00:06:09,670 --> 00:06:14,970
So here I can actually specify that what types of animals are going to be inside always.

90
00:06:14,980 --> 00:06:17,370
So now it would only select only tame animals.

91
00:06:17,410 --> 00:06:19,270
If we only check this checkbox here.

92
00:06:19,270 --> 00:06:25,220
This means that we have only the animals that are inside of these tame Underland animals folder.

93
00:06:25,420 --> 00:06:31,600
So in other words only the images that are inside of this tape Underland animals for there are going

94
00:06:31,600 --> 00:06:38,050
to be available to us and this valuable as you can see here a number of available animals this valuable

95
00:06:38,080 --> 00:06:45,010
is going to hold the number of images that can be actually used in insight or Kiwis or here if we actually

96
00:06:45,070 --> 00:06:47,050
also check the search box here.

97
00:06:47,050 --> 00:06:54,640
This means that though the number of animals that are going to be available are actually always going

98
00:06:54,640 --> 00:07:01,120
to be also these animals here that are inside of this world under like animals so hopefully that makes

99
00:07:01,120 --> 00:07:04,490
sense so in that case all animals names list.

100
00:07:04,600 --> 00:07:11,980
So about this list actually holds the animals that you specified and then adding on elements names.

101
00:07:11,990 --> 00:07:13,050
These thoughts cise.

102
00:07:13,210 --> 00:07:18,460
So here is going to actually give us the number of animals the size of this list and then we can actually

103
00:07:18,460 --> 00:07:23,040
assign that size to the number of available animals valuable.

104
00:07:23,380 --> 00:07:24,880
So hopefully that makes sense.

105
00:07:24,880 --> 00:07:27,180
And here as you can see we have a void.

106
00:07:27,370 --> 00:07:28,120
Right.

107
00:07:28,120 --> 00:07:31,390
So let's look at this while up here and let's see what's going on here.

108
00:07:31,420 --> 00:07:37,120
Here if you say wild counter so as you can see here we created these counter-rally label in line number

109
00:07:37,120 --> 00:07:44,980
two hundred and fifty three vial counter is less than or equal to number of animals included increase.

110
00:07:44,980 --> 00:07:51,490
So now if I actually scroll to the top here as you can see inside this class if you actually created

111
00:07:51,490 --> 00:07:56,080
this constant as you can see here a number of animals included increase.

112
00:07:56,320 --> 00:08:02,140
And then I assigned the value number 10 to this constant And this means that we're going to have 10

113
00:08:02,470 --> 00:08:05,950
questions 10 animals in sight always.

114
00:08:05,950 --> 00:08:11,440
So as you can see here if I click on dispatch button here as you can see it says this is animal of one

115
00:08:11,440 --> 00:08:11,930
of 10.

116
00:08:11,950 --> 00:08:14,760
So this means that you're going to have 10 questions 10 and months.

117
00:08:14,770 --> 00:08:15,630
Right.

118
00:08:15,640 --> 00:08:22,120
So let me scroll down here and let's actually again go inside our my favorite is that animal quis.

119
00:08:22,340 --> 00:08:25,430
So here as you can see let me show you the loop here.

120
00:08:25,430 --> 00:08:32,720
As you can see so until vide the value of this counter which is now one is less than or equal to a number

121
00:08:32,720 --> 00:08:37,910
of animals including the inquiries which is 10 then it's going to actually go inside the curly braces

122
00:08:37,910 --> 00:08:41,870
of this for a while loop and then it's going to actually execute the lines of code that are inside of

123
00:08:41,870 --> 00:08:43,400
the white tube here.

124
00:08:43,760 --> 00:08:49,850
First as you can see here we actually created vit where it's going to recreate of the of type integer

125
00:08:49,880 --> 00:08:52,840
and the name of this variable is a random index.

126
00:08:52,840 --> 00:08:53,540
Right.

127
00:08:53,790 --> 00:09:00,100
Assignment operator and then I refer to the name of this variable secure random number.

128
00:09:00,200 --> 00:09:05,480
So now if we actually scroll to the top of the file here inside our main activity fragment class as

129
00:09:05,480 --> 00:09:12,290
you can see here in line number 48 by actually declared this variable which is of type secure random

130
00:09:12,380 --> 00:09:15,900
and this variable name is secure random number.

131
00:09:15,920 --> 00:09:21,260
So the job of this variable is actually to hold a random number or secure random number.

132
00:09:21,260 --> 00:09:21,540
Right.

133
00:09:21,560 --> 00:09:23,610
That's the only job of this value.

134
00:09:23,720 --> 00:09:28,760
And then here as you can see inside this main activity for fragment in line number 70 I am actually

135
00:09:28,760 --> 00:09:33,920
initializing this rowdier but your random number assignment operator new secure random number.

136
00:09:33,920 --> 00:09:42,720
So now we have as truly an object of type secure random that can actually hold on a random value right.

137
00:09:42,740 --> 00:09:48,470
So let's actually go inside our Richard Quest Meffert And let's see how we can use this secure random

138
00:09:48,500 --> 00:09:49,510
object.

139
00:09:49,520 --> 00:09:57,020
So now inside this loop here random index assignment operator secure random number.

140
00:09:57,170 --> 00:09:58,060
That's next.

141
00:09:58,090 --> 00:10:05,660
And so by calling dismay at the next int as you can see here we can actually get our random integer

142
00:10:05,660 --> 00:10:06,540
value.

143
00:10:06,950 --> 00:10:11,840
And here it says not are actually assigned number of available any months.

144
00:10:11,900 --> 00:10:17,780
So it's going to give us a value between 0 and the value that we specify here.

145
00:10:17,780 --> 00:10:20,210
Number of available animals.

146
00:10:20,330 --> 00:10:25,660
So the number of available animals is going to be of value that is specified here.

147
00:10:25,680 --> 00:10:28,250
All animals names these sites.

148
00:10:28,310 --> 00:10:31,780
Right so for example let me show you the structure of the project.

149
00:10:31,790 --> 00:10:37,340
So for example inside tame animals for there if we specified that we're going to have only tame animals

150
00:10:37,710 --> 00:10:38,990
in sight always.

151
00:10:39,020 --> 00:10:43,400
Then as you can see here for example it's actually count the number of images that we have here one

152
00:10:43,730 --> 00:10:53,670
two three four five six seven eight 9 10 11 12.

153
00:10:53,690 --> 00:10:57,980
So we have 12 images inside this team Underland animals folder.

154
00:10:58,160 --> 00:11:00,290
So this is going to be 12 for example.

155
00:11:00,320 --> 00:11:01,020
Right.

156
00:11:01,220 --> 00:11:05,450
And now it's going to actually give us our random value secure and the next.

157
00:11:05,450 --> 00:11:11,830
It means that it's going to give us a random value between 0 and 12 right.

158
00:11:11,900 --> 00:11:16,170
And then it's going to be assigned at random value to the standard index.

159
00:11:16,610 --> 00:11:24,290
So now as you can see here in line number 240 as you can see we created another variable which is of

160
00:11:24,290 --> 00:11:27,210
type String animal image name.

161
00:11:27,290 --> 00:11:30,900
This is the name of this valuable assignment operator here.

162
00:11:31,070 --> 00:11:34,110
And I actually further to the name of this list here.

163
00:11:34,130 --> 00:11:41,090
All animals names the list dot get a random index right.

164
00:11:41,120 --> 00:11:46,660
So here at this piece of code here it's going to actually give us our random value or random image path

165
00:11:46,700 --> 00:11:47,360
as you can see here.

166
00:11:47,380 --> 00:11:49,550
Let me show you the structure of the project.

167
00:11:49,550 --> 00:11:55,280
For example we have specified that we want to only have tame animals inside our project as you can see

168
00:11:55,280 --> 00:11:55,630
here.

169
00:11:55,670 --> 00:11:57,110
All animals names these.

170
00:11:57,320 --> 00:12:03,530
And now actually contains these images right dot get a random index so you can actually randomly select

171
00:12:03,530 --> 00:12:04,400
one of these images.

172
00:12:04,400 --> 00:12:09,020
For example this flappy bird and then it's going to actually assign that value to this animal.

173
00:12:09,020 --> 00:12:11,740
Image Name which is actually of type string.

174
00:12:11,740 --> 00:12:12,530
Right.

175
00:12:12,650 --> 00:12:17,540
And now as you can see here we have actually an if statement.

176
00:12:18,040 --> 00:12:25,370
So if I need molls names quiz list that contains So as you can see here I put an exclamation mark here.

177
00:12:25,390 --> 00:12:25,920
Right.

178
00:12:25,960 --> 00:12:35,140
So this exclamation marks me here means not if animals names quiz list does not contain animal image

179
00:12:35,140 --> 00:12:37,140
name as you can see here.

180
00:12:37,150 --> 00:12:44,170
So here we have an if statement and this statement here means if animals names cuius least if the animals

181
00:12:44,170 --> 00:12:49,900
that are going to be inside our quits as you can see here these animals names quizz this this list is

182
00:12:49,900 --> 00:12:55,570
going to actually hold our randomly selected images that we have inside our coolies.

183
00:12:55,570 --> 00:12:58,650
So here we are going to have only 10 questions right.

184
00:12:58,690 --> 00:13:06,720
So if this list does not contain as you can see here this exclamation mark here means not if animals

185
00:13:06,940 --> 00:13:12,420
names This list does not contain animal image name as you can see here.

186
00:13:12,670 --> 00:13:20,320
So here we are taking that we are not going to for example add a duplicated image value a duplicated

187
00:13:20,350 --> 00:13:22,680
image to always right.

188
00:13:22,700 --> 00:13:27,280
We're going to have every time that we actually answer a question the next question is going to be a

189
00:13:27,280 --> 00:13:29,370
different question or different animal.

190
00:13:29,380 --> 00:13:37,660
So here we are saying that if it if the image that is actually inside our animals names because this

191
00:13:37,900 --> 00:13:40,700
is actually the same as animals.

192
00:13:40,900 --> 00:13:45,370
Image Name here as you can see then it's not going to actually execute this statement.

193
00:13:45,400 --> 00:13:51,670
Here we are thinking that if animals names This list does not contain animal image name.

194
00:13:51,670 --> 00:13:58,840
So if we don't have duplicated our image inside our quiz then it's going to actually add that image

195
00:13:58,840 --> 00:14:04,610
to these animals names quizzes so animals names quislings start at animal image.

196
00:14:04,960 --> 00:14:05,620
Right.

197
00:14:05,920 --> 00:14:08,480
And then it's going to increment the counter by Yvonne.

198
00:14:08,500 --> 00:14:09,100
Right.

199
00:14:09,100 --> 00:14:13,440
So here for example because we're going to have only 10 questions inside our quiz.

200
00:14:13,600 --> 00:14:16,390
So the initial value is 1.

201
00:14:16,510 --> 00:14:19,000
So it can actually increment this counter.

202
00:14:19,330 --> 00:14:22,900
And then until until it reaches to the value for example Number 10.

203
00:14:22,900 --> 00:14:30,670
So here we are checking that until the value account is equal or let Actually it is actually less than

204
00:14:30,730 --> 00:14:33,280
or equal to number of animals included in quiz.

205
00:14:33,460 --> 00:14:37,030
So until it reaches to the number 10 and then it's going as it should is why look.

206
00:14:37,150 --> 00:14:41,080
And when it reaches to the value in number 11 as you can see here it's not going to actually raise it

207
00:14:41,210 --> 00:14:41,890
this way.

208
00:14:42,100 --> 00:14:47,680
And it's going to keep this piece of code here and it's and then it's going to actually show the results

209
00:14:47,680 --> 00:14:48,390
to the user.

210
00:14:49,230 --> 00:14:50,870
So hopefully that makes sense.

211
00:14:50,880 --> 00:14:57,540
And we have also the Smurfette show next animal which we are going to add later but for now I want you

212
00:14:57,540 --> 00:15:03,120
to actually just look at these lines of code here that we put inside this wretched animal cookies and

213
00:15:03,120 --> 00:15:05,570
just figure out what's going on here.

214
00:15:05,640 --> 00:15:06,080
Right.

