1
00:00:00,360 --> 00:00:06,600
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

2
00:00:06,600 --> 00:00:07,400
on here.

3
00:00:08,800 --> 00:00:15,670
So as you can see here these are the lines of code that I pasted here and now I'm going to try to explain

4
00:00:15,670 --> 00:00:17,150
to you what's going on here.

5
00:00:17,200 --> 00:00:18,320
Exactly.

6
00:00:18,330 --> 00:00:20,890
So now let's actually look at our Meffert here.

7
00:00:20,920 --> 00:00:26,750
So the access modifier of arms if it is private the return type of RMF it is void.

8
00:00:27,040 --> 00:00:31,760
And as you can see the name of RMF it is show next animal right.

9
00:00:31,780 --> 00:00:38,950
So the job of the Smurfette is to actually show the quiz actually question the picture of the animal

10
00:00:39,010 --> 00:00:45,220
and the quiz questions are actually the guest buttons and then we can actually see the question and

11
00:00:45,220 --> 00:00:46,890
then we can answer the question right.

12
00:00:46,900 --> 00:00:50,490
So that's the only job of this method.

13
00:00:50,500 --> 00:00:56,270
So now let's actually go inside the curly braces of the Smurfette And let's see what's going on here.

14
00:00:56,620 --> 00:01:02,620
So in line number three hundred twenty nine as you can see here we have actually a variable which is

15
00:01:02,620 --> 00:01:03,780
of type string.

16
00:01:03,790 --> 00:01:04,420
Right.

17
00:01:04,420 --> 00:01:08,240
So the name of this variable is the next animal image name.

18
00:01:08,410 --> 00:01:08,950
Right.

19
00:01:08,980 --> 00:01:15,520
So this variable is going to hold the actually the name of the animal image that you're going to show

20
00:01:15,580 --> 00:01:16,880
it to the user.

21
00:01:16,900 --> 00:01:23,890
So if it's an assignment operator here and then I actually first released animals names quiz list so

22
00:01:23,890 --> 00:01:29,390
this list is actually supposed to actually hold the images.

23
00:01:29,470 --> 00:01:29,840
OK.

24
00:01:29,860 --> 00:01:33,210
The animal images that you're going to have inside our quiz.

25
00:01:33,430 --> 00:01:38,310
So animal names quiz list dot remove.

26
00:01:38,590 --> 00:01:39,820
Index 0.

27
00:01:39,940 --> 00:01:45,770
So this means that it's going to actually remove the value that is inside of the index zero of this

28
00:01:45,770 --> 00:01:46,220
list.

29
00:01:46,270 --> 00:01:52,950
Animals names quiz list and then we're going to actually assign that removed value to this next animal.

30
00:01:52,960 --> 00:01:54,280
Image Name.

31
00:01:54,460 --> 00:01:59,380
So now we actually moved the first value that you have inside our least.

32
00:01:59,530 --> 00:02:04,960
OK so this list is going to hold the animal image names that you're going to show to the to.

33
00:02:04,960 --> 00:02:06,260
Right.

34
00:02:06,280 --> 00:02:13,640
So you're going to actually first of all remove the first value that is inside of the index 0 and then

35
00:02:13,730 --> 00:02:19,200
you going to actually assign that remove the value to the next animal image name which is a five string

36
00:02:19,210 --> 00:02:26,230
right in line number 350 as you can see here are you referred to the name of this variable is going

37
00:02:26,230 --> 00:02:29,280
to hold the actually the correct answer.

38
00:02:29,290 --> 00:02:31,780
The correct answer to the first question.

39
00:02:31,780 --> 00:02:37,550
So let me actually show you the emulator and then and then I'm going to talk about that here.

40
00:02:37,600 --> 00:02:41,420
So now you can see here our application is running on this emulator.

41
00:02:41,600 --> 00:02:47,150
And now for example this is actually the first question that is actually shown to us.

42
00:02:47,200 --> 00:02:54,490
So now as you can see here we're going to actually first of all remove the first value that we have

43
00:02:54,490 --> 00:03:00,110
inside our quiz and then we're going to assign that value to the next animal image name.

44
00:03:00,250 --> 00:03:07,060
And then here this variable which is supposed to actually hold the correct answer of every question.

45
00:03:07,060 --> 00:03:10,480
So as you can see here this is our first question right.

46
00:03:10,480 --> 00:03:16,910
This is animal one of 10 and this very Abella correct animals answer is actually a variable of type

47
00:03:16,960 --> 00:03:24,790
three and that is supposed to hold the correct answer of every question that we actually ask from the

48
00:03:24,790 --> 00:03:25,480
user.

49
00:03:25,480 --> 00:03:28,710
So as you can see this is the first question here.

50
00:03:28,780 --> 00:03:31,450
For example this is actually a rabbit right.

51
00:03:31,450 --> 00:03:34,330
So here we should actually choose the rapid Libet here.

52
00:03:34,360 --> 00:03:38,990
So the correct animal's answer is going to actually hold this rabbit.

53
00:03:39,070 --> 00:03:40,710
Right.

54
00:03:40,720 --> 00:03:45,370
And then first of all because this is actually the question that you're showing to the user first you

55
00:03:45,370 --> 00:03:50,840
need to actually empted is why you hear the answer to the answer that it takes.

56
00:03:50,920 --> 00:03:52,770
This is actually an empty value.

57
00:03:52,990 --> 00:03:59,690
So now this valuable correct answer actually holds this value rabbit.

58
00:03:59,750 --> 00:04:02,650
And now let's actually look at this line of code here.

59
00:04:02,930 --> 00:04:05,970
It is like number three hundred and thirty free.

60
00:04:06,040 --> 00:04:07,610
The question numbered.

61
00:04:07,690 --> 00:04:10,860
So he asks the question number is this takes here.

62
00:04:10,870 --> 00:04:13,290
This is animal 1 for example of 10.

63
00:04:13,330 --> 00:04:17,200
So this is that he asks the question number that said text.

64
00:04:17,410 --> 00:04:19,990
And then I called the Smurfette here to get the strength.

65
00:04:20,050 --> 00:04:24,810
And if I actually hold the comments on my keyboard if you are using a Windows machine use actually to

66
00:04:24,820 --> 00:04:30,400
hold the controls on your keyboard and then click on this three inch My here as you can see we actually

67
00:04:30,400 --> 00:04:36,300
get this method from the fragment of a file as he can hear from the fragments class.

68
00:04:36,670 --> 00:04:40,850
So Nalut me actually close this fragment of a file here.

69
00:04:41,050 --> 00:04:42,420
So it gets strange.

70
00:04:42,790 --> 00:04:46,730
And now as can see here this method here actually accepts free arguments.

71
00:04:46,870 --> 00:04:54,880
The first argument is the actually the string value is this resource value so all that string that question

72
00:04:54,920 --> 00:04:56,090
underlined text.

73
00:04:56,200 --> 00:05:02,050
So anality actually go inside is strings that exemplified all I can actually hold are the comment on

74
00:05:02,050 --> 00:05:02,620
my keyboard.

75
00:05:02,620 --> 00:05:08,540
And again if you are using a Windows machine just hold the control on your keyboard and this rally you

76
00:05:08,540 --> 00:05:10,540
hear question underlying text.

77
00:05:10,760 --> 00:05:16,000
And now as you can see here you can actually see this value here inside these strings that exemplified.

78
00:05:16,220 --> 00:05:21,680
And this is actually a stunning resource question underlined text and this rather is this I hold this

79
00:05:21,680 --> 00:05:22,190
value.

80
00:05:22,190 --> 00:05:29,090
This is animal so percent want dollar sign the means this is actually the first argument which is of

81
00:05:29,090 --> 00:05:30,530
type integer.

82
00:05:30,890 --> 00:05:38,840
And of person two dollar sign the means actually this is the second argument that actually is an integer

83
00:05:38,840 --> 00:05:39,850
value.

84
00:05:39,860 --> 00:05:43,310
So let me ask you to go inside this main activity fragment of a file.

85
00:05:43,340 --> 00:05:49,950
So as you can see here for the first argument right for the first argument which is this value here.

86
00:05:50,540 --> 00:05:53,870
Number of right answers plus 1.

87
00:05:53,870 --> 00:06:00,070
So initially when we actually start our quiz application the value of this number of right answers value

88
00:06:00,290 --> 00:06:01,660
is actually zero right.

89
00:06:01,670 --> 00:06:08,270
Initially the value of this number of answers variable is zero because we just started our application

90
00:06:08,270 --> 00:06:17,630
here and now we want to actually say that number of answers plus 1 means that this is actually given

91
00:06:17,660 --> 00:06:18,400
here for example.

92
00:06:18,410 --> 00:06:22,640
This is the number of answers here is 0 0 plus 1 is 1.

93
00:06:22,640 --> 00:06:24,500
So here it's going to actually put this value here.

94
00:06:24,500 --> 00:06:27,040
This is animal 1 right.

95
00:06:27,410 --> 00:06:31,270
And then as you can see here number of animals included inquiries.

96
00:06:31,280 --> 00:06:32,760
So this is the number 10 here.

97
00:06:32,760 --> 00:06:35,770
So here as you can see we're going to have 10 questions right.

98
00:06:35,780 --> 00:06:40,710
10 animal images here so that you use that can actually get the name of these animals.

99
00:06:40,790 --> 00:06:44,270
So that's the purpose of these of these two lines of code here.

100
00:06:44,330 --> 00:06:50,890
As you can see and now in line number three hundred and thirty six we have another line of code here.

101
00:06:50,990 --> 00:06:53,820
And now let's actually look at this line of code here.

102
00:06:53,930 --> 00:07:00,140
We have actually a string value but then name of my string about eleven is animal type.

103
00:07:00,200 --> 00:07:08,050
I put an assignment operator here and then as you can see here next animal image name right.

104
00:07:08,150 --> 00:07:11,410
Next animal image name that substrate.

105
00:07:11,570 --> 00:07:18,170
And as you can see here this method substring is going to actually just separate are symbols.

106
00:07:18,180 --> 00:07:23,570
So for example here next animal image name that substory is going to give us a substring of the set

107
00:07:23,780 --> 00:07:26,550
of a string value that you pass to this method.

108
00:07:26,570 --> 00:07:31,560
So this will let me actually just show you these arguments of this Moffit next.

109
00:07:31,570 --> 00:07:34,480
And in one image name that substring.

110
00:07:34,880 --> 00:07:42,490
And now as you can see this if it accepts two arguments the first one is actually an integer.

111
00:07:42,500 --> 00:07:49,640
And then in this BGN index and the second argument is actually again of type integer and the name is

112
00:07:49,730 --> 00:07:50,690
an index.

113
00:07:50,690 --> 00:07:57,620
So here we can actually specify the beginning index and the ending index of of this string value that

114
00:07:57,620 --> 00:08:03,630
we pass through this method and then we can actually get the remaining starting value.

115
00:08:03,950 --> 00:08:08,230
So now for example let me just add that it's this line of code here.

116
00:08:08,240 --> 00:08:13,340
So as you can see here we're actually specifying the beginning index which is actually zero.

117
00:08:13,520 --> 00:08:16,100
And then if you are specifying the ending index.

118
00:08:16,160 --> 00:08:19,310
So people I tell you about this piece of code here.

119
00:08:19,310 --> 00:08:24,770
First let me actually tell you about the purpose of this line of code here as you can see we are actually

120
00:08:24,770 --> 00:08:30,160
getting that type of the animal which is actually the answer right.

121
00:08:30,180 --> 00:08:35,470
So now let me show you the emulator as you can see this is the image that you're showing to the user.

122
00:08:35,630 --> 00:08:41,480
So we should actually put this image to the user and we should actually get this image from the actual

123
00:08:41,510 --> 00:08:42,650
assets folder.

124
00:08:42,710 --> 00:08:43,210
Right.

125
00:08:43,370 --> 00:08:49,010
So when you want to load this image and when we want to show this image to the user first we need to

126
00:08:49,010 --> 00:08:54,020
actually get the type of the animal that you are actually dealing with.

127
00:08:54,020 --> 00:08:56,660
So here we are actually leading with our rabbit.

128
00:08:56,660 --> 00:09:00,350
So that type of this animal is for example a tame animal.

129
00:09:00,350 --> 00:09:02,440
So now let me show you the structure of the project.

130
00:09:02,450 --> 00:09:08,900
Just click on view to tool those and then project and now as you can see here inside the structure of

131
00:09:08,900 --> 00:09:12,910
the project inside these assets folder we have two folders.

132
00:09:12,980 --> 00:09:17,200
The first one is PAME underline elements and the second folder is void.

133
00:09:17,210 --> 00:09:21,010
Underline any months and when we want to actually show the image.

134
00:09:21,110 --> 00:09:27,440
OK so for example when the show and animal method is called We need to actually get the image of the

135
00:09:27,440 --> 00:09:31,810
animal that we want to show to the user and we need to actually load it here right.

136
00:09:31,820 --> 00:09:37,400
So first in order to do that in order to actually load that image here we need to first get the type

137
00:09:37,400 --> 00:09:42,560
of the animal so that we can actually go inside these assets will there and then go inside that specific

138
00:09:42,560 --> 00:09:48,600
folder paper underline any months or voyde Underland any months and then we can actually get that specific.

139
00:09:48,660 --> 00:09:54,120
For example image so as you can see here this is actually our tame animal.

140
00:09:54,200 --> 00:09:58,850
So you can actually go inside these tame Underland animals and then we can actually find this animal

141
00:09:58,850 --> 00:09:59,450
here.

142
00:09:59,630 --> 00:10:01,900
But look at this animal name here.

143
00:10:01,910 --> 00:10:07,440
Look at the name of this image came under like anemones dashed rabbit.

144
00:10:07,740 --> 00:10:08,270
Right.

145
00:10:08,280 --> 00:10:10,310
So let's look at this line of code here.

146
00:10:10,320 --> 00:10:14,780
As you can see here we actually created a thing valuable and the name is animal type.

147
00:10:14,790 --> 00:10:17,940
So the purpose of this rally is to get the animal type.

148
00:10:18,000 --> 00:10:19,950
I put an assignment operator here.

149
00:10:20,160 --> 00:10:22,790
And then you referred to the name of the value.

150
00:10:22,800 --> 00:10:24,840
Next animal image name.

151
00:10:24,870 --> 00:10:29,090
Right next animal image name is the value that we actually created.

152
00:10:29,090 --> 00:10:32,500
Here's in line number three hundred twenty nine right.

153
00:10:32,760 --> 00:10:36,450
So now next animal image name that Suppes dream.

154
00:10:36,510 --> 00:10:38,290
So we call this substring method.

155
00:10:38,310 --> 00:10:39,720
On this next animal image name.

156
00:10:39,740 --> 00:10:46,240
So that this is going to give us a substring of the string that we call this Mefford on.

157
00:10:46,320 --> 00:10:46,810
Right.

158
00:10:46,980 --> 00:10:49,750
So next animal is named that substrate first.

159
00:10:49,820 --> 00:10:52,140
We are actually specifying the beginning index.

160
00:10:52,140 --> 00:10:57,650
So the beginning index is actually the first actually the first character of this name.

161
00:10:57,660 --> 00:11:02,430
So as you can see here the first character of this name is that is the character t.

162
00:11:02,490 --> 00:11:03,270
Right.

163
00:11:03,300 --> 00:11:08,830
So it's going to actually start from the beginning index which is actually this value here.

164
00:11:08,970 --> 00:11:12,060
This index 0 which is this right.

165
00:11:12,420 --> 00:11:15,270
And now we need to specify the ending index.

166
00:11:15,270 --> 00:11:20,430
So as you can see here for the second argument here I am specifying the ending index.

167
00:11:20,700 --> 00:11:26,860
Next animal image name dot index of dash as you can see here.

168
00:11:27,150 --> 00:11:31,390
It's going to actually look at this name here and it's going to actually find the stash here.

169
00:11:31,470 --> 00:11:38,730
As you can see so the beginning index is T and the ending index is this is the stash here right.

170
00:11:38,790 --> 00:11:43,360
So this method here is this substring Meffert is going to actually give us.

171
00:11:43,620 --> 00:11:50,610
There actually is string value that starts with T and ends with this end in each index which is actually

172
00:11:50,610 --> 00:11:54,030
the stash character but not including this character.

173
00:11:54,060 --> 00:11:59,220
So this is just going to actually give us disvalue that starts with T and just ends with this ending

174
00:11:59,220 --> 00:12:02,620
character but not including this ending character.

175
00:12:02,880 --> 00:12:07,860
And he says I'm going to ask you to give us this value and then it's going to actually eliminate the

176
00:12:07,860 --> 00:12:10,610
remaining part which is this rabbit that PAGG.

177
00:12:10,620 --> 00:12:14,720
So in this way we can actually get this animal type right.

178
00:12:14,730 --> 00:12:21,650
So now that the animal type is tame under live animals and then it's going to be assigned this videotape

179
00:12:21,750 --> 00:12:24,450
Underland months to these animal type.

180
00:12:24,450 --> 00:12:26,930
So let me explain again here what's going on.

181
00:12:26,970 --> 00:12:30,160
Next animal image name that substring.

182
00:12:30,180 --> 00:12:34,560
So it's going to give us a substring of this thing value that we pass to this method and here as you

183
00:12:34,560 --> 00:12:37,770
can see first we are specifying the beginning index.

184
00:12:37,770 --> 00:12:40,090
So the beginning index is t.

185
00:12:40,440 --> 00:12:43,740
And here we need to specify the ending index.

186
00:12:43,740 --> 00:12:47,830
So next animal image name dot index of dash.

187
00:12:47,910 --> 00:12:54,270
So the index of that is here and then it's going to give us this this thing value that starts with T

188
00:12:54,720 --> 00:12:58,170
and ends with dash but not including the character.

189
00:12:58,320 --> 00:13:00,480
And then it's going to give us only That's value.

190
00:13:00,600 --> 00:13:03,510
And then it's going to actually assign that value to the animal type.

191
00:13:03,510 --> 00:13:07,930
So in this way we can actually get the type of the animal here.

192
00:13:07,950 --> 00:13:11,760
So now the type is animal is actually tape on the line.

193
00:13:11,970 --> 00:13:16,170
For example in this case we can see that this is actually a rabbit.

194
00:13:16,180 --> 00:13:19,150
So that type is tame Underland animals.

195
00:13:19,410 --> 00:13:21,400
So hopefully that makes sense.

196
00:13:21,430 --> 00:13:25,960
And now let me actually double click on this tab here in order to make this area vital.

197
00:13:25,970 --> 00:13:28,500
And now let's actually look at the other lines of code here.

