1
00:00:00,360 --> 00:00:07,620
So now as you can see here these are the lines of code that I pasted here and now I'm going I try to

2
00:00:07,620 --> 00:00:09,890
explain to you what's going on here.

3
00:00:09,900 --> 00:00:11,250
Exactly.

4
00:00:11,250 --> 00:00:18,070
So now look at the Smurfit here the access modifier of this method is Puplick and this means that this

5
00:00:18,070 --> 00:00:24,300
method is going to be accessible from anywhere inside our project and the return type of this method

6
00:00:24,300 --> 00:00:24,840
is void.

7
00:00:24,840 --> 00:00:29,910
And this means that this method is going to return Nuffield the name of this method is reset.

8
00:00:30,040 --> 00:00:34,510
Annabelle Quince So what's the purpose of this method when this method is going to be called.

9
00:00:34,560 --> 00:00:35,810
Let me show you the emulator.

10
00:00:35,970 --> 00:00:43,860
So now for example let me actually click on back here so as you can see here this is our quiz and now

11
00:00:44,070 --> 00:00:49,440
I want to actually go inside these settings activity and here for example I want to change the background

12
00:00:49,440 --> 00:00:50,990
color of my quiz.

13
00:00:51,000 --> 00:00:58,530
So for example I want to change it to black and now as you can see here a post here appears and it says

14
00:00:58,530 --> 00:01:00,050
new changes are applied.

15
00:01:00,240 --> 00:01:06,870
And this means that are going to actually reset our animal quiz now when the user actually changes the

16
00:01:06,870 --> 00:01:08,280
settings of the application.

17
00:01:08,280 --> 00:01:09,860
You want to reset the animal always.

18
00:01:09,900 --> 00:01:15,160
And we want to start up our quiz from actually knew from start at.

19
00:01:15,180 --> 00:01:20,220
If I click on dispatch button here as you can see now that back uncolored is black and Ahlquist is now

20
00:01:20,220 --> 00:01:21,320
reset.

21
00:01:21,330 --> 00:01:28,120
So for example I can actually change the font for example to wander space them all as you can see here.

22
00:01:28,140 --> 00:01:32,150
Now the format is changed now again our quiz is reset.

23
00:01:32,160 --> 00:01:38,100
So when we actually change the actually the settings of our application we want to reset the quiz.

24
00:01:38,370 --> 00:01:45,300
So we set animal cookies and in line number two hundred and eight we have actually a variable of type

25
00:01:45,390 --> 00:01:46,970
asset manager.

26
00:01:46,980 --> 00:01:49,160
The name of our valuable is assets.

27
00:01:49,380 --> 00:01:51,940
So now let me show you the structure of the project.

28
00:01:52,080 --> 00:01:56,480
So just click on view to Windows and then click on Project.

29
00:01:56,630 --> 00:02:00,840
And now here at the right hand side you can see the structure of the project.

30
00:02:01,020 --> 00:02:04,890
And here as you can see we have a folder called assets.

31
00:02:04,890 --> 00:02:09,740
So if you want to actually access these assets for that because we have this tape underline animals

32
00:02:09,740 --> 00:02:12,980
for there we have this avoid Underland animals for that.

33
00:02:12,990 --> 00:02:15,100
And we have these phones for that right.

34
00:02:15,120 --> 00:02:19,190
If you want to access this assets folder in order to access these folders.

35
00:02:19,260 --> 00:02:25,230
So I actually created a variable of type asset manager and the name is assets.

36
00:02:25,230 --> 00:02:33,210
And then I put an assignment operator here and I called the Smurfette get activity dot get assets.

37
00:02:33,320 --> 00:02:39,330
So my favorite activity is going to give give us the activity and then by calling these get assets on

38
00:02:39,330 --> 00:02:45,130
that activity we can actually get the assets for that that we have inside our project.

39
00:02:45,150 --> 00:02:50,820
So now we have actually access this project to this actually for their assets.

40
00:02:50,820 --> 00:02:56,810
And now by actually getting to these assets are valuable we can actually get access at these assets.

41
00:02:57,010 --> 00:03:01,680
So it's actually a doubleclick undismayed activity fragment out of a file in order to make this area

42
00:03:01,710 --> 00:03:03,840
wider in low numbers.

43
00:03:03,840 --> 00:03:10,000
Two hundred and nine as you can see here are you referred to these all animals names list.

44
00:03:10,350 --> 00:03:13,120
So let's actually scroll to the top here.

45
00:03:13,200 --> 00:03:20,920
As you can see inside our class in line number 41 I actually declared this variable which is a type

46
00:03:21,000 --> 00:03:24,600
place that actually accepts values of types 3.

47
00:03:25,140 --> 00:03:27,100
And the name is all animals.

48
00:03:27,100 --> 00:03:29,620
And these are all animals names list.

49
00:03:29,700 --> 00:03:36,040
So this rally is going to hold all the animals names that we are going to have inside our quiz.

50
00:03:36,120 --> 00:03:41,910
And if you look at our uncreate view Meffert as you can see here in line number sixty eight I actually

51
00:03:41,910 --> 00:03:49,430
initialized this variable all animals all animals names least assignment operator new at a list.

52
00:03:49,470 --> 00:03:50,420
Right.

53
00:03:50,430 --> 00:03:54,890
So remember that I told you that list is actually an interface right.

54
00:03:54,900 --> 00:03:59,050
We cannot directly create an object of typeless.

55
00:03:59,100 --> 00:04:07,080
So because this is an interface and list actually has more Misfit's that other than an array of we actually

56
00:04:07,080 --> 00:04:14,080
created a list in order to actually take advantage of those extra effets that list interface has.

57
00:04:14,250 --> 00:04:19,570
And we actually initialized this list by using aerialist riced new Aurelia's.

58
00:04:19,580 --> 00:04:26,130
So we're going to have an array list of values but the data type is list so that we can actually access

59
00:04:26,190 --> 00:04:28,860
those extra efforts that this list has.

60
00:04:28,900 --> 00:04:33,910
You can actually looked at the documentation of this list interface in say the Java doc.

61
00:04:34,350 --> 00:04:37,830
So all animals names list right.

62
00:04:37,830 --> 00:04:44,380
So let's actually scroll down here inside our Meffert reset animal quiz on here.

63
00:04:44,430 --> 00:04:46,650
All animals names least that clear.

64
00:04:46,650 --> 00:04:49,810
So I call this Meffert that clear on this list.

65
00:04:49,830 --> 00:04:51,120
So what does this mean.

66
00:04:51,120 --> 00:04:58,560
So whenever I asked what I want to actually reset our animal quiz Are you want to actually delete all

67
00:04:58,560 --> 00:05:05,030
the animals names that in say the quiz and then you want to add the new Actually animal names.

68
00:05:05,040 --> 00:05:09,230
So for example here for example the first question is actually peacock.

69
00:05:09,390 --> 00:05:15,600
And now for example I want to change the Paglen color of the application to yellow and now are actually

70
00:05:15,660 --> 00:05:16,830
arccos is reset.

71
00:05:16,890 --> 00:05:22,390
And if I click on dispatch button here as you can see that the first animal is another animal of a sheep.

72
00:05:22,470 --> 00:05:23,070
Right.

73
00:05:23,070 --> 00:05:29,340
So this means that all animals names the list is actually cleared and all there are names that we had

74
00:05:29,700 --> 00:05:32,490
in the previous quiz is actually cleared.

75
00:05:32,520 --> 00:05:36,540
And now we have a new quiz with the new animals names.

76
00:05:36,540 --> 00:05:39,940
So that's really important that you put this method here.

77
00:05:39,990 --> 00:05:40,970
This line of code.

78
00:05:41,430 --> 00:05:44,300
And then if you have a try catch block here.

79
00:05:44,310 --> 00:05:48,640
So let's look at this troika's black and let's see what's going on here.

80
00:05:48,750 --> 00:05:54,480
So try and inside the curly braces of this type like here as you can see here we have some lines of

81
00:05:54,480 --> 00:05:55,240
code here.

82
00:05:55,320 --> 00:05:57,790
So we have actually a for loop.

83
00:05:57,930 --> 00:06:05,430
So for strange animal type and now as you can see here we are actually iterating over the values of

84
00:06:05,430 --> 00:06:07,460
these animal types in Queens.

85
00:06:07,800 --> 00:06:11,190
So let's actually look at inside our class at the top.

86
00:06:11,190 --> 00:06:13,320
Let's scroll to the top here.

87
00:06:13,500 --> 00:06:18,330
As you can see in line number 43 we actually declared this set here.

88
00:06:18,330 --> 00:06:24,670
So remember that I told you that sets are actually again our interfaces as you can see here.

89
00:06:24,700 --> 00:06:33,020
It is actually an interface but because sets can not have duplicated values we actually created a set

90
00:06:33,030 --> 00:06:40,150
in order to take advantage of that extra feature set that actually accepts values of types 3.

91
00:06:40,230 --> 00:06:41,110
Right.

92
00:06:41,340 --> 00:06:44,730
And now the name is animal types in coins.

93
00:06:44,730 --> 00:06:50,910
So now let me show you the emulator as you can see it actually to go inside settings activity and then

94
00:06:51,050 --> 00:06:51,560
here.

95
00:06:51,720 --> 00:06:58,080
Now for example you want to actually change the types of the animal as you can see here we have wild

96
00:06:58,110 --> 00:07:05,310
animals and we have tame animals and for example I want to have only tame animals inside my quiz or

97
00:07:05,430 --> 00:07:10,050
maybe even to have wild animals inside my quiz for example.

98
00:07:10,050 --> 00:07:10,860
Right.

99
00:07:10,950 --> 00:07:15,600
I can I should click on OK here and now as you can see here it says new changes are applied.

100
00:07:15,790 --> 00:07:21,180
And now if I click on this page button here as you can see now you are going to have only wild animals

101
00:07:21,360 --> 00:07:25,130
the images of only wild animals inside our quits.

102
00:07:25,620 --> 00:07:29,900
So that's why I actually created this variable here which is I've typeset.

103
00:07:30,000 --> 00:07:35,300
That actually is going to determine the types of the animal that we're going to have inside our quiz.

104
00:07:35,340 --> 00:07:41,510
So this set is responsible is responsible for actually holding the types of the animals that we have

105
00:07:41,510 --> 00:07:42,720
inside the quiz.

106
00:07:43,110 --> 00:07:49,110
So let's actually go back into Andrex studio and now let's actually scroll down here and let's go inside

107
00:07:49,170 --> 00:07:51,740
our research animalcules Meffert.

108
00:07:52,020 --> 00:07:53,090
So this is our method.

109
00:07:53,280 --> 00:08:00,110
And now I want to iterate over the values that that we have inside these animal types inquiries.

110
00:08:00,180 --> 00:08:06,360
So here let me show you an important point here that inside the uncreate view method we haven't still

111
00:08:06,420 --> 00:08:13,080
initialized these animal types inquiries actually said we are not going to initialize it here.

112
00:08:13,110 --> 00:08:18,200
Later you will see that we're going to initialize that set in another place inside our code.

113
00:08:18,360 --> 00:08:24,180
But for now just know that we haven't initialized these animal types in here yet.

114
00:08:24,210 --> 00:08:29,280
So let's actually go back inside our Reset animalcules here.

115
00:08:29,550 --> 00:08:35,850
So animal type is going to actually go iterate over the values of these animal types inquiries.

116
00:08:35,850 --> 00:08:42,240
So this follow up here is going to be executed for each value that we have inside these animal types

117
00:08:42,240 --> 00:08:42,960
inquiries.

118
00:08:43,020 --> 00:08:43,980
Right.

119
00:08:44,040 --> 00:08:50,550
And then for example for the first time this animal type is going to hold the value of the first value

120
00:08:50,580 --> 00:08:53,820
of the first index that we have inside these animal types inquiries.

121
00:08:53,820 --> 00:08:55,300
So animal type.

122
00:08:55,550 --> 00:09:00,870
And now let's actually go inside it for look and let's see what's going on here in line number two hundred

123
00:09:00,870 --> 00:09:01,890
and fifteen.

124
00:09:01,890 --> 00:09:05,950
We have an array of strength values right.

125
00:09:06,180 --> 00:09:11,450
And here as you can see the name is animal image paths in Queens.

126
00:09:11,490 --> 00:09:14,720
So here let me show you the structure of the project again.

127
00:09:14,760 --> 00:09:19,770
So click on the View tool windows and then click on project as you can see here.

128
00:09:19,780 --> 00:09:22,470
This is this is the structure of the project.

129
00:09:22,770 --> 00:09:28,560
And inside is as its folder as you can see here we have this folders tame underline anemones and we

130
00:09:28,560 --> 00:09:31,960
have also this fall that ovoid underline anemones.

131
00:09:32,010 --> 00:09:33,410
So this is actually our path.

132
00:09:33,420 --> 00:09:38,310
First we need to go inside these assets for there and then if we need to go inside this for example

133
00:09:38,390 --> 00:09:45,100
taint on the line animals animals and then for example I want to actually to access this you came on

134
00:09:45,110 --> 00:09:52,160
the line anemones dash Dolfin that Pinti for example if you want to actually access this image this

135
00:09:52,410 --> 00:09:58,600
image of the Dolfin first I need to go inside the assets folder and that I need to go inside this tape

136
00:09:58,670 --> 00:10:05,190
underlying animals fall there and then I can actually access this value this image on the line.

137
00:10:05,200 --> 00:10:07,840
Animals dash Dolfin that PND.

138
00:10:08,240 --> 00:10:10,390
So that's what I did here.

139
00:10:10,640 --> 00:10:17,600
So I actually created an array of string values and the name is animal image paths inquiries.

140
00:10:17,600 --> 00:10:18,810
So this is actually the path.

141
00:10:18,860 --> 00:10:20,030
Right.

142
00:10:20,180 --> 00:10:26,210
And then I put an assignment operator here and I actually further to these assets here in order to access

143
00:10:26,210 --> 00:10:29,120
the assets for that that we have inside our project.

144
00:10:29,420 --> 00:10:34,300
So assets at least as we can see here assets that list.

145
00:10:34,310 --> 00:10:39,740
So it's going to go inside these assets folder and then it's going to actually look at the folders that

146
00:10:39,740 --> 00:10:41,950
we have inside these assets for that right.

147
00:10:42,380 --> 00:10:50,210
And then I actually passed this value to this list animal type so by passing this value animal type

148
00:10:50,260 --> 00:10:53,430
this is actually the lasting value to this list here.

149
00:10:53,770 --> 00:11:00,840
It's going to actually give us the specific folder that we actually have inside our assets folder.

150
00:11:00,830 --> 00:11:07,540
So for example if the animal type is tame on the line Alamance then it's going to actually give us the

151
00:11:07,540 --> 00:11:11,400
least the images that we have inside this tape on the tent.

152
00:11:11,410 --> 00:11:13,320
Tame underlain animals folder.

153
00:11:13,390 --> 00:11:13,830
Right.

154
00:11:13,970 --> 00:11:17,050
So then it's going to try to assign those values as you can see here.

155
00:11:17,060 --> 00:11:24,430
Here we have an ad right in order to actually hold the paths of these images that we have inside our

156
00:11:24,640 --> 00:11:25,840
four folders.

157
00:11:25,870 --> 00:11:29,190
This on the animals or underlying animals.

158
00:11:29,200 --> 00:11:35,370
So when I call these assets folder I can actually access this assets for that and I call this list folder

159
00:11:35,860 --> 00:11:43,210
excuse me and then I call this list method on these assets in order to access the values that we have

160
00:11:43,270 --> 00:11:45,010
inside our assets folder.

161
00:11:45,010 --> 00:11:50,040
And then I pass the name of the folder that we have inside our assets folder.

162
00:11:50,050 --> 00:11:54,750
So for example the name of the folder or the animal type is tape on the animals right.

163
00:11:54,760 --> 00:11:55,910
Tame animals.

164
00:11:55,990 --> 00:12:01,840
When I pass this value to the Smurfette least then it's going to give us the values that we have inside

165
00:12:01,870 --> 00:12:02,860
our folder.

166
00:12:02,860 --> 00:12:09,010
So for example it's going to give us these images the path of these images that we have inside our project

167
00:12:09,330 --> 00:12:15,640
or for example if I pass the wild animals if that animal type is wild Underland animals then it's going

168
00:12:15,820 --> 00:12:20,920
to keep us the paths of these images right inside our project.

169
00:12:21,010 --> 00:12:25,290
And then it's going to assign those values to this animal image paths increase.

170
00:12:25,750 --> 00:12:32,080
And now as you can see here let me actually double click on this main activity flagmen that have a double

171
00:12:32,080 --> 00:12:35,940
tap here at the top in order to make this area wider.

172
00:12:36,010 --> 00:12:37,540
Again we have another follow up.

173
00:12:37,540 --> 00:12:39,590
We have actually an inner for loop.

174
00:12:39,850 --> 00:12:49,030
So for strange animal image path in Queens is going to actually either rate all of the values of this

175
00:12:49,090 --> 00:12:52,440
animal image paths which is actually this great.

176
00:12:52,570 --> 00:13:00,790
So I want to actually get each and every image path that we have inside our animal folders so for example

177
00:13:01,180 --> 00:13:03,800
now you can see inside the structure of the project.

178
00:13:03,910 --> 00:13:09,650
We have this tame underline anemones and we have also this wild animal or wild underlain animals.

179
00:13:09,820 --> 00:13:16,000
It depends on the use that which type of animals he or she wants to use in say the case.

180
00:13:16,000 --> 00:13:22,320
So for example I can actually choose only tame animals not wild animals right.

181
00:13:22,510 --> 00:13:28,330
In that case if you passed the actually the animal type which is actually tame animal as you can see

182
00:13:28,330 --> 00:13:31,300
here we're going to have only tame animals right.

183
00:13:31,330 --> 00:13:36,610
So it's going to actually give us the least of these images of these tame animals here.

184
00:13:36,610 --> 00:13:40,870
And then it's going to assign that value actually assigning those values to these animal image paths

185
00:13:40,870 --> 00:13:44,420
increase which is actually an array of string values.

186
00:13:44,590 --> 00:13:50,020
And then here we are going to either rate over those paths over those values those image paths that

187
00:13:50,020 --> 00:13:55,670
we have inside these for example tame underline animals and we want to actually execute this follow

188
00:13:55,670 --> 00:14:03,370
up here for each and every value for each and every path that we have inside this list right inside

189
00:14:03,370 --> 00:14:05,040
the same underlying folder.

190
00:14:05,260 --> 00:14:13,000
So strange animal image paff inquiries iterate over the animal image paths the inquiries and as you

191
00:14:13,000 --> 00:14:15,850
can see here all animals names list.

192
00:14:15,850 --> 00:14:21,790
So now let me actually double click on this tab here main activity fragment or Java tab and here I actually

193
00:14:21,800 --> 00:14:23,580
first to the name of this list.

194
00:14:23,620 --> 00:14:25,480
All animals names list.

195
00:14:25,480 --> 00:14:32,380
So as you can see here in line number two on the night I actually cleared all the values first and now

196
00:14:32,410 --> 00:14:34,940
I want to add other values to this actually.

197
00:14:35,010 --> 00:14:37,170
All animals names list.

198
00:14:37,210 --> 00:14:45,730
So all animals names and they start at al-Ahmad image Paphian quis as you can see here dots replace

199
00:14:46,150 --> 00:14:50,350
dot P and G with actually an empty value.

200
00:14:50,740 --> 00:14:54,610
I want to actually start peon Jeevan I want to show this value to the user.

201
00:14:54,610 --> 00:14:59,400
So for example let me ask you to show you the emulator as you can see we have no doubt Pendu here right.

202
00:14:59,410 --> 00:15:03,150
As you can see people Pinguin fish flappy bird and goat.

203
00:15:03,280 --> 00:15:07,660
We don't have paint Pinguin that P and G or fish that be being G or flappy bird.

204
00:15:07,660 --> 00:15:14,230
That means you all go to the TNG you actually deleted the P.A. part of these images of these image names.

205
00:15:14,290 --> 00:15:18,920
I want to show you actually when I want to show these values to the user.

206
00:15:19,000 --> 00:15:21,850
So it is very important that you put this in I've got here.

207
00:15:22,240 --> 00:15:28,210
All animals names start at and it's going I should add all these image paths as you can see here all

208
00:15:28,210 --> 00:15:28,690
these images.

209
00:15:28,700 --> 00:15:32,220
It's going to is going to be added to these animals named list here.

210
00:15:32,470 --> 00:15:35,690
But the piano here is going to be deleted.

211
00:15:36,220 --> 00:15:37,320
Right.

212
00:15:37,720 --> 00:15:45,820
And now and we also created this Smurfette get the exact animal name effect as you can see here in order

213
00:15:45,820 --> 00:15:54,240
to actually delete that part of the image that has for example an underline.

214
00:15:54,370 --> 00:15:54,910
OK.

215
00:15:55,210 --> 00:16:00,790
So we use these methods in order to actually delete the parts of the name of the image that we don't

216
00:16:00,790 --> 00:16:02,080
want to show to the user.

217
00:16:02,080 --> 00:16:04,730
So now it's actually double click on this tab here.

218
00:16:04,880 --> 00:16:06,590
Activity fragment that Java.

219
00:16:06,950 --> 00:16:11,530
And now let's actually go again inside this reset animal quis Mefford.

220
00:16:11,570 --> 00:16:15,470
So as you can see here we have also the church statement.

221
00:16:15,470 --> 00:16:19,630
So this caterpillar here is going to actually catch the exceptions that may occur.

222
00:16:19,870 --> 00:16:24,550
And we want to actually access our image paths inside our project.

223
00:16:24,620 --> 00:16:25,290
Right.

224
00:16:25,370 --> 00:16:31,640
So we may actually access around image or are the Android device may not be able to actually access

225
00:16:31,640 --> 00:16:34,090
the images that we have inside the project.

226
00:16:34,280 --> 00:16:41,660
So in that case we have actually a catch block which is going to a church that exception and we're going

227
00:16:41,660 --> 00:16:45,780
to actually plug our message through that actually Lockart.

228
00:16:45,890 --> 00:16:51,870
So log that eat and that is animal Cooley's and the message is error.

229
00:16:52,010 --> 00:16:58,360
And here we're going to actually output the real error message to they're actually locked.

230
00:16:58,760 --> 00:17:03,350
So here are a list like let's actually look at these other lines of code here.

