1
00:00:00,450 --> 00:00:04,170
So here we have a like fragment and the name of art.

2
00:00:04,350 --> 00:00:07,320
Like fragment is animal cuius results right.

3
00:00:07,320 --> 00:00:10,250
So now let me show you the emulator as you can see here.

4
00:00:10,260 --> 00:00:16,620
This is our dialogue and here as you can see this is actually a description that let us know about the

5
00:00:16,620 --> 00:00:18,250
results of the quiz.

6
00:00:18,360 --> 00:00:20,480
So now let's go inside this.

7
00:00:20,490 --> 00:00:21,420
They like fragment.

8
00:00:21,440 --> 00:00:23,990
As you can see here we have this method here.

9
00:00:23,990 --> 00:00:26,350
Uncreate dialogue right.

10
00:00:26,370 --> 00:00:30,410
So this is going to be called a venti de-lurk is actually created.

11
00:00:30,810 --> 00:00:37,790
And now as you can see here the return type of this method is dialogue and this it actually accepts

12
00:00:37,810 --> 00:00:42,820
an argument of type Bondel and the name is saved instance state.

13
00:00:42,840 --> 00:00:47,250
So let's go inside the Smurfette And let's see what's going on here in LA.

14
00:00:47,250 --> 00:00:50,130
Number one hundred and fifty two as you can see here.

15
00:00:50,400 --> 00:00:56,460
Here I actually created a builder so alert Stalock that builder and the name Is that right.

16
00:00:56,520 --> 00:01:03,770
New assignment operator new ALLERT de-lurk as you can see here that bill there and here are this bill

17
00:01:03,770 --> 00:01:06,730
that he actually accepts an argument.

18
00:01:06,750 --> 00:01:09,180
So here we need to pass the context.

19
00:01:09,360 --> 00:01:11,890
So the context is going to be good activity.

20
00:01:12,030 --> 00:01:16,920
So this activity method as you can see here does get actually with him if it can actually give us the

21
00:01:16,920 --> 00:01:18,070
context.

22
00:01:18,090 --> 00:01:22,870
So automatically we can actually get the context by actually using this method.

23
00:01:22,920 --> 00:01:23,950
Good activity.

24
00:01:24,240 --> 00:01:29,890
And now we have an object that object a number of one hundred and fifty three.

25
00:01:29,910 --> 00:01:35,000
He had I actually referred to the name of this builder so builder that said message.

26
00:01:35,280 --> 00:01:37,920
So here we need to set a message of this builder.

27
00:01:38,260 --> 00:01:42,770
And now you can see here again I called the Smurfette get strange.

28
00:01:42,990 --> 00:01:46,830
So now let me show you the emulator as you can see here we have this value.

29
00:01:46,900 --> 00:01:49,280
This thing value 10 number of guesses.

30
00:01:49,320 --> 00:01:49,980
Come on.

31
00:01:50,070 --> 00:01:54,240
And one hundred point zero zero percent correct.

32
00:01:54,240 --> 00:01:56,200
So let's think of it.

33
00:01:56,370 --> 00:02:02,630
And now as you can see here for the first argument I need to actually pass this Thring resource value.

34
00:02:02,670 --> 00:02:10,260
So our thoughts throwing darts results underlines Thring underlying value but we haven't actually added

35
00:02:10,310 --> 00:02:13,680
this disvalue to the strength that thinks that exemplified.

36
00:02:13,800 --> 00:02:15,450
So let's copy this name here.

37
00:02:15,450 --> 00:02:19,440
This results the string underlying value here and now.

38
00:02:19,530 --> 00:02:23,310
And now let's actually go inside the strings that exemplify it.

39
00:02:23,700 --> 00:02:30,450
And here let's actually create a string here sort of just open a tag and just type in here strange and

40
00:02:30,450 --> 00:02:32,190
the name is going to be that's valued at.

41
00:02:32,190 --> 00:02:38,520
We're doing that we're actually pasting here results on the length strange underline a value as you

42
00:02:38,520 --> 00:02:39,450
can see here.

43
00:02:39,810 --> 00:02:42,660
And now let's actually close this tack here.

44
00:02:42,900 --> 00:02:47,430
And for the value I'm going to pasting a value here and then I'm going to explain to you what's going

45
00:02:47,430 --> 00:02:48,230
on here.

46
00:02:48,480 --> 00:02:53,580
So as you can see here this is the value that I pasted here inside this attack here.

47
00:02:53,580 --> 00:03:01,140
So for the first argument per cent one dollar sign D as you can see here this is the first argument.

48
00:03:01,140 --> 00:03:04,680
Number of guesses come on.

49
00:03:05,070 --> 00:03:11,820
And as you can see here we have actually a floating a value or the symbol value per cent to a dollar

50
00:03:11,820 --> 00:03:15,990
sign point zero to f percent percent.

51
00:03:15,990 --> 00:03:17,060
So what does this mean.

52
00:03:17,160 --> 00:03:21,780
So this means that here as you can see this person 2 means that this is going to be our second argument

53
00:03:22,230 --> 00:03:23,160
dollar sign here.

54
00:03:23,160 --> 00:03:28,840
Again this is actually a format that when we need to put this dollar sign here in order to specify that

55
00:03:28,850 --> 00:03:32,580
we are going to actually put an integer.

56
00:03:32,580 --> 00:03:39,140
Actually our value may be an integer value or a floating value or this dollar sign here is necessary

57
00:03:39,140 --> 00:03:44,830
you need to put a dollar sign here in order to in order to specify here that this is actually an argument.

58
00:03:44,970 --> 00:03:50,160
So percent to dollar sign means that this is going to be our second argument.

59
00:03:50,160 --> 00:03:55,770
So because here I want to specify of the similar value of floating number.

60
00:03:56,050 --> 00:04:04,170
I actually put this thought here 0 2 so this 0 zero here means that we are going to have two similar

61
00:04:04,170 --> 00:04:07,690
values two values after the decimal digit right.

62
00:04:07,710 --> 00:04:15,480
So 0 2 F again because this is actually a decimal value we need to put this if here as you can see here

63
00:04:15,660 --> 00:04:17,800
because this is actually an integer value.

64
00:04:17,850 --> 00:04:19,230
We put this here.

65
00:04:19,380 --> 00:04:21,620
But here we have a similar value.

66
00:04:21,620 --> 00:04:28,980
If we put f here and here because I want to actually show that to the user the percent character I put

67
00:04:29,160 --> 00:04:31,380
this person's character here twice.

68
00:04:31,620 --> 00:04:37,530
OK so if it if you want to show the person's character with the user you need to put this person's character

69
00:04:37,560 --> 00:04:39,000
twice here right.

70
00:04:39,000 --> 00:04:42,090
So percent percent and it's going I should show it to the user.

71
00:04:42,090 --> 00:04:47,960
The person here as you can see and then as you can see correct I actually put this value here correct.

72
00:04:48,030 --> 00:04:50,790
So 10 for example here 10 number of guesses.

73
00:04:50,790 --> 00:04:51,560
Come on.

74
00:04:51,690 --> 00:04:59,120
And 100 point two of one hundred point zero zero percent correct.

75
00:04:59,130 --> 00:05:01,450
So that makes sense.

76
00:05:01,450 --> 00:05:06,300
And now let's actually go inside this main activity fragment that you have a file here.

77
00:05:06,510 --> 00:05:10,350
So as you can see here Bill there are that.

78
00:05:11,040 --> 00:05:14,630
So I believe that that message as you can see here gets thrown out.

79
00:05:14,700 --> 00:05:15,780
So I call this method.

80
00:05:15,780 --> 00:05:20,970
So for the first argument again I actually referred to that string resource or that string.

81
00:05:20,970 --> 00:05:23,980
That results underlines the value.

82
00:05:24,210 --> 00:05:27,220
Here for the second argument of this gets three Meffert.

83
00:05:27,380 --> 00:05:30,480
You need to specify the number of all guesses.

84
00:05:30,480 --> 00:05:37,230
So as you can see here if I go back inside this string that exemplified it to specify the first argument

85
00:05:37,230 --> 00:05:38,130
right.

86
00:05:38,430 --> 00:05:39,950
One dollar sign.

87
00:05:39,960 --> 00:05:41,790
So this is going to be an integer value.

88
00:05:41,790 --> 00:05:44,310
So let's go back to our main activity fragment out of a file.

89
00:05:44,330 --> 00:05:49,980
So a number of all guesses here is going to be the first argument number of all guesses as you can see

90
00:05:49,980 --> 00:05:52,180
here for example 10 number of cases.

91
00:05:52,590 --> 00:05:58,350
And as you can see here we are actually calculating the percent right here.

92
00:05:58,400 --> 00:06:02,600
We are actually calculating the results so that we can actually show the results to the user.

93
00:06:02,910 --> 00:06:09,210
So inside the Prentice's as you can see I am actually putting I actually put this operation here 1000

94
00:06:09,570 --> 00:06:15,030
divided by and here as you can see I am actually to cast in this number of all guesses as you can see

95
00:06:15,030 --> 00:06:15,640
here.

96
00:06:15,810 --> 00:06:19,800
I am actually casting at this value which is an integer value to a double value.

97
00:06:19,920 --> 00:06:20,160
Right.

98
00:06:20,160 --> 00:06:23,330
So temporarily we have a double value.

99
00:06:23,520 --> 00:06:26,960
We have actually a double version of this value which is actually integer.

100
00:06:26,970 --> 00:06:29,790
So number of all guesses which is now a double.

101
00:06:29,790 --> 00:06:33,580
So 1000 divided by number of all guesses.

102
00:06:33,700 --> 00:06:39,300
So because he had kissed all of the questions right and we had only 10 number of guesses.

103
00:06:39,300 --> 00:06:44,660
So 1000 divided by 10 results in number of 100.

104
00:06:44,670 --> 00:06:45,050
Right.

105
00:06:45,090 --> 00:06:48,900
So because this is actually a double value it gives us a double value.

106
00:06:48,900 --> 00:06:52,530
One hundred point zero zero percent correct.

107
00:06:52,530 --> 00:06:57,780
So this is how we calculate the results and we can actually show that result to the user.

108
00:06:57,870 --> 00:06:59,630
So hopefully that makes sense.

109
00:06:59,970 --> 00:07:03,860
And here as you can see in line number one hundred fifty seven.

110
00:07:03,940 --> 00:07:09,110
Bill there I actually referred to the name of this builder that said positive pot.

111
00:07:09,120 --> 00:07:13,390
And so as you can see here we have a button here reset the animal keys right.

112
00:07:13,410 --> 00:07:17,840
So if you actually click on the spot in here the animal is going to be restarted.

113
00:07:17,850 --> 00:07:22,730
And then we can actually again play with our quiz game.

114
00:07:22,760 --> 00:07:27,000
So Bill there that's a positive button as you can see here.

115
00:07:27,000 --> 00:07:33,640
So for the first argument as you can see I actually specified this are three dots.

116
00:07:33,660 --> 00:07:35,890
Reset animalcules right.

117
00:07:36,090 --> 00:07:43,440
So now let me ask you to show you that if any to actually provide this string the source inside are

118
00:07:43,680 --> 00:07:45,140
strings that exemplified.

119
00:07:45,270 --> 00:07:51,430
So let's actually copy this value here and now let's actually go inside this string that exemplified.

120
00:07:51,560 --> 00:07:54,540
And here let's create a string resource.

121
00:07:54,750 --> 00:07:57,910
So just open a tag and just type in here straight.

122
00:07:58,200 --> 00:08:00,900
And for the name just a paste that's value here.

123
00:08:01,080 --> 00:08:07,530
Reset underline more underline quis right and then close the stack aren't afford the value as you can

124
00:08:07,530 --> 00:08:14,260
see here again just for example typing here restart or just typing reset.

125
00:08:14,460 --> 00:08:19,830
Or you can actually put other values here or I can't just type in reload it doesn't really matter what

126
00:08:19,830 --> 00:08:20,440
you put here.

127
00:08:20,470 --> 00:08:24,390
Restart restart squeeze restart animalcules

128
00:08:27,380 --> 00:08:28,220
right.

129
00:08:28,470 --> 00:08:32,480
And now I can actually go back inside our main activity fragment that of a fight.

130
00:08:32,580 --> 00:08:34,840
And now as you can see here the error is gone.

131
00:08:35,370 --> 00:08:39,770
And here because I want to specify a button for this dialogue as you can see here.

132
00:08:39,900 --> 00:08:45,870
I need to actually first specify devalued the name of the button which is disvalue reset underline animal

133
00:08:45,930 --> 00:08:49,280
Underland quiz for the second argument as you can see here.

134
00:08:49,290 --> 00:08:53,730
I am actually creating our on our listener for that Potten.

135
00:08:53,730 --> 00:08:58,650
So whenever the user touches the spot in here this dialog is going to be notified and it's going to

136
00:08:58,650 --> 00:09:05,010
actually respond according to that are actually not so new dialogue interface.

137
00:09:05,010 --> 00:09:11,090
So because I want to create a listener for this button inside this dialogue we need to create a list.

138
00:09:11,280 --> 00:09:17,220
And unclick listener for this dialogue interface so new they like interface that unclick listener so

139
00:09:17,220 --> 00:09:22,550
it can actually create an anonymous class that actually conforms to this unclick listener interface.

140
00:09:22,800 --> 00:09:25,950
And then it's going to actually over I dismiss it here for us.

141
00:09:25,950 --> 00:09:30,600
So unclick And as you can see here it is unclear if it accepts two arguments.

142
00:09:30,600 --> 00:09:33,280
The first one is the dialogue interface.

143
00:09:33,450 --> 00:09:39,800
Then is dialogue and the second one is actually an integer and its of its name is which.

144
00:09:39,840 --> 00:09:43,470
So it just means that which one is actually selected.

145
00:09:43,470 --> 00:09:46,720
So here it is because we have only one button here.

146
00:09:46,860 --> 00:09:54,030
As you can see when I click on that our application is actually restarted it always is that is reset

147
00:09:54,060 --> 00:09:55,850
and we can actually start over.

148
00:09:56,100 --> 00:10:00,100
So I actually called on my feet here reset animalcules.

149
00:10:00,240 --> 00:10:00,710
Right.

150
00:10:00,840 --> 00:10:06,080
So if any is that it actually touches that spot and dismiss it here is going to be executed.

151
00:10:06,120 --> 00:10:09,570
Reset animalcules but we havent created this method yet.

152
00:10:09,600 --> 00:10:14,370
If you are going to actually create the Smurfette later in our code but for now just put this value

153
00:10:14,370 --> 00:10:14,690
here.

154
00:10:14,700 --> 00:10:23,750
As you can see and now here after this Meffert after this lesson and actually as you can see here you

155
00:10:23,760 --> 00:10:31,430
need to actually turn as you can see need to return value of type dialog from this uncreate dialog Meffert.

156
00:10:31,440 --> 00:10:32,180
Right.

157
00:10:32,190 --> 00:10:35,850
So here I actually return just typing here.

158
00:10:35,870 --> 00:10:38,600
Return builder does create.

159
00:10:38,600 --> 00:10:39,120
Right right.

160
00:10:39,150 --> 00:10:42,680
So it's going to return a value of type dialog.

161
00:10:42,720 --> 00:10:48,360
So it is very important that you put this line of code here before the curly brace of this uncreate

162
00:10:48,510 --> 00:10:57,040
large here and now as you can see at the bottom here you can see that we have this animalcules results.

163
00:10:57,050 --> 00:11:02,910
They like fragments so as you can see after the in curly brace of the Stalock fragment.

164
00:11:02,970 --> 00:11:06,290
Now you need to actually call two other methods here.

165
00:11:06,460 --> 00:11:07,860
Animal Marquise results.

166
00:11:07,860 --> 00:11:09,080
So this is the name of art.

167
00:11:09,140 --> 00:11:12,150
Actually they like fragments right.

168
00:11:12,250 --> 00:11:18,870
Animalcules results that said Transurban cancelable false and this means that for example Lydney actually

169
00:11:19,170 --> 00:11:19,600
does this.

170
00:11:19,600 --> 00:11:23,750
And once again here and there and because I want to actually show you the dialogue again.

171
00:11:24,300 --> 00:11:30,840
So as you can see here this is our dialogue here and now as you can see we can't actually cancel this

172
00:11:30,840 --> 00:11:31,670
dialogue right.

173
00:11:31,680 --> 00:11:38,100
If they actually click on here or here we don't have any options in order to cancel the Stalock we must

174
00:11:38,100 --> 00:11:41,010
actually click on the spot and reset the animalcules.

175
00:11:41,220 --> 00:11:45,390
So that's why I actually put this method here the results.

176
00:11:45,420 --> 00:11:49,250
So these are dialogue that said cancelable false.

177
00:11:49,440 --> 00:11:51,880
And in this way we cannot cancel this dialogue.

178
00:11:51,990 --> 00:11:55,680
The user must click on this button in order to reset the keys.

179
00:11:56,400 --> 00:12:02,540
And in line 151 as you can see here I actually referred to the name of this animal quiz results.

180
00:12:02,540 --> 00:12:04,710
Here again this is our dialogue.

181
00:12:04,990 --> 00:12:05,400
Sure.

182
00:12:05,400 --> 00:12:10,520
So we need to actually call this method show on our animalcules results.

183
00:12:10,560 --> 00:12:13,610
So that is going to actually show this to the user.

184
00:12:13,770 --> 00:12:19,330
So animal quiz results that show and for the measure there should access to argument.

185
00:12:19,350 --> 00:12:24,160
The first one is actually the fragment manager when it was specified the BRAITMAN manager.

186
00:12:24,300 --> 00:12:29,160
So in order to put that value here you can't just simply refer to that to the name of the Smurfette

187
00:12:29,430 --> 00:12:30,660
get fragment manager.

188
00:12:30,660 --> 00:12:36,390
So it's going to automatically give us the fragments manager comma and for the second argument we need

189
00:12:36,390 --> 00:12:37,730
to specify the tack.

190
00:12:37,980 --> 00:12:43,620
So the tag could be any values but I recommend that you actually specify a meaning full value and the

191
00:12:43,620 --> 00:12:44,890
Marquise results.

192
00:12:44,940 --> 00:12:47,280
So this is the tag that we need to specify here.

193
00:12:47,280 --> 00:12:52,300
So as you can see this is actually the osting value and then it's going to show that I like to use it.

194
00:12:52,530 --> 00:12:55,110
And here we have an else statement.

195
00:12:55,110 --> 00:13:01,800
So now as you can see this statement here is really is actually related to this if statement If number

196
00:13:01,800 --> 00:13:06,550
of right answers is equal to number of animals included inquiries.

197
00:13:06,630 --> 00:13:11,240
So if they use that as I should it just all the questions right.

198
00:13:11,560 --> 00:13:14,960
And now we have we have an else statement.

199
00:13:15,030 --> 00:13:18,560
So this means that we haven't seen or finished the quiz.

200
00:13:18,570 --> 00:13:22,920
So if we actually click on these resets the animalcules here is going to reset the quiz for us.

201
00:13:22,920 --> 00:13:27,820
For example now if I actually click on this dark here it's going to wait.

202
00:13:27,880 --> 00:13:31,720
For example one second or two second and it's going to show us the next image.

203
00:13:31,720 --> 00:13:37,070
So if there actually is not actually if there actually a quiz is not finished yet.

204
00:13:37,120 --> 00:13:43,300
If the user needs to for example answer some more other questions inside our quiz then it's going to

205
00:13:43,300 --> 00:13:45,090
execute this statement.

206
00:13:45,370 --> 00:13:51,490
So in other words this if statement here is actually determining whether this quiz is actually finished

207
00:13:51,520 --> 00:13:52,100
or not.

208
00:13:52,140 --> 00:13:52,360
OK.

209
00:13:52,360 --> 00:13:57,520
If the number of right answers is equal to a number of animals included in inquiries then this means

210
00:13:57,520 --> 00:14:02,440
that the quiz is actually finished and that's the time that it's going to actually show that to the

211
00:14:02,440 --> 00:14:04,640
user that you like.

212
00:14:04,840 --> 00:14:10,330
But if the quiz is not finished yet so he's going to actually execute this statement.

213
00:14:10,570 --> 00:14:14,180
And here I actually referred to the name of this handler.

214
00:14:14,230 --> 00:14:19,330
So I actually declared this handler here inside our class as you can see here this is our handler in

215
00:14:19,330 --> 00:14:26,290
line number 44 and we actually initialized this handler inside our uncreate view Meffert handler assignment

216
00:14:26,290 --> 00:14:27,280
operator new handler.

