1
00:00:00,660 --> 00:00:07,740
So now let me talk about this ELSE IF statement here again because I think it is necessary for you to

2
00:00:07,740 --> 00:00:10,580
understand exactly what's going on here.

3
00:00:10,800 --> 00:00:17,610
So here we are saying that as if the key equals animals type and this means that if they use it has

4
00:00:17,610 --> 00:00:20,570
actually interacted with the animals type.

5
00:00:20,580 --> 00:00:22,930
So let me actually show you the emulator.

6
00:00:23,160 --> 00:00:29,520
So now as I said this is our emulator and our application is running on this emulator and here as you

7
00:00:29,520 --> 00:00:32,970
can see the key is actually animals typewrite.

8
00:00:32,970 --> 00:00:39,120
Here we are saying that if the key equals animal type and if the user actually interacted with the animals

9
00:00:39,150 --> 00:00:42,850
type then it's going to execute this LCF statement here.

10
00:00:42,870 --> 00:00:43,400
Right.

11
00:00:43,620 --> 00:00:46,610
So now let's actually look at this LCF statement.

12
00:00:46,620 --> 00:00:53,130
So inside this ELSE IF statement a block of code as you can see if you have actually a string set light

13
00:00:53,820 --> 00:01:00,150
and in Him is animal types so if you have a set of string values and the name is animal types assignment

14
00:01:00,150 --> 00:01:00,840
operator.

15
00:01:01,080 --> 00:01:06,600
So I referred to the name of this shirt the preferences object that we actually receive as an argument

16
00:01:06,600 --> 00:01:12,660
from this on shows preference changed Mefford so shared preferences that gets things set.

17
00:01:12,690 --> 00:01:18,090
So by calling this method gets things said we can actually get our set of string values from these shirt

18
00:01:18,090 --> 00:01:19,010
preferences.

19
00:01:19,440 --> 00:01:26,550
And we passed the key Alamance thought in order to specify that from which component we want to get

20
00:01:26,550 --> 00:01:32,000
these values from these animals type if you want to actually get these actually values.

21
00:01:32,010 --> 00:01:36,150
So now if I actually go inside these quotes underline preferences that makes them a file as you can

22
00:01:36,150 --> 00:01:39,810
see we have this multi-select list preference here.

23
00:01:40,260 --> 00:01:45,930
And we actually do pro-white that are key attributes for this multi-select preference in order to interact

24
00:01:45,930 --> 00:01:50,620
with this multi-select at least prevents it from Florida of course.

25
00:01:50,760 --> 00:01:56,370
And now let's actually go back into our main activity the java file here so Chaudry for analysis that

26
00:01:56,370 --> 00:02:03,520
gets said the plastic animals underlying tarp type come on and for the first value we passed the value.

27
00:02:03,750 --> 00:02:10,310
And that it's going to actually assign our animal the value of the animals type to these animal types.

28
00:02:10,320 --> 00:02:11,210
String set.

29
00:02:11,220 --> 00:02:14,750
So if so here we actually created an if statement.

30
00:02:14,850 --> 00:02:23,400
So if the animals type is not equal to all and animal animals type animal types that size is actually

31
00:02:23,400 --> 00:02:30,810
greater than zero if for example they use it at least selected one of these checkboxes as you can see

32
00:02:30,810 --> 00:02:34,010
here if you use that actually to check out one of these checkboxes.

33
00:02:34,190 --> 00:02:40,820
Then as you can see here if I click on OK here now it's going to execute this statement and it's going

34
00:02:40,840 --> 00:02:42,180
actually just.

35
00:02:42,220 --> 00:02:48,960
You are referring to this my animal Quest fragment that the type of animals inquiries and we passed

36
00:02:48,960 --> 00:02:51,760
this shirt preferences in order to get those values.

37
00:02:52,200 --> 00:02:53,800
And then we actually reset the quiz.

38
00:02:53,880 --> 00:02:57,080
So my only quiz AFFREIGHTMENT that really said animal quiz.

39
00:02:57,330 --> 00:03:00,950
And here we have actually an else statement as you can see here.

40
00:03:00,960 --> 00:03:10,320
So if the user has actually if use a do not does not want to actually have these wild animals or tame

41
00:03:10,320 --> 00:03:17,850
animals but inside the quiz OK if they use it does not want to actually select either of these options

42
00:03:18,270 --> 00:03:23,760
and then click on OK here then it's going to actually execute this Else statement.

43
00:03:23,760 --> 00:03:25,450
So now let me click on OK here.

44
00:03:25,560 --> 00:03:31,270
As you can see and notice one type must be selected right and divide elements is the default values

45
00:03:31,280 --> 00:03:34,490
Top Chef preferences that editor.

46
00:03:34,500 --> 00:03:41,100
So as you can see here you are actually creating an editor object shared preferences that editor editor

47
00:03:41,400 --> 00:03:45,090
assignment operator and and here we are actually referring to these shows.

48
00:03:45,110 --> 00:03:50,580
Preferences are objects that we receive as an argument from dismiss it as you can see here.

49
00:03:50,640 --> 00:03:51,180
Right.

50
00:03:51,210 --> 00:03:52,890
So Sheft references that edit.

51
00:03:52,950 --> 00:03:53,540
Right.

52
00:03:53,580 --> 00:03:56,960
So now that we actually are.

53
00:03:57,120 --> 00:04:03,210
Now we want to actually create an editor object in order to put our default value into our quiz.

54
00:04:03,300 --> 00:04:03,790
Right.

55
00:04:03,870 --> 00:04:07,340
So now as you can see animal types that at.

56
00:04:07,380 --> 00:04:10,090
So you want to add value to these animal types set.

57
00:04:10,350 --> 00:04:17,390
And here we call the Smurfette get strange and we passed this value or that string that default underline

58
00:04:17,430 --> 00:04:18,950
animal underline type.

59
00:04:18,960 --> 00:04:24,190
So if I actually hold the comment here on my keyboard and click on this value here as you can see disvalue

60
00:04:24,360 --> 00:04:25,590
is this right here right.

61
00:04:25,770 --> 00:04:30,030
Default underline animal underline type wide underline animals.

62
00:04:30,090 --> 00:04:35,410
So this value is going to be the default value of the type of the animals that you want to have inside

63
00:04:35,410 --> 00:04:36,130
the quiz.

64
00:04:36,420 --> 00:04:39,750
So now let me go back inside RMI an activity that have a file.

65
00:04:40,020 --> 00:04:43,140
And here again refers to the name of this editor object.

66
00:04:43,190 --> 00:04:51,060
So editor that put strings set and we passed the key and then we passed these animal types set.

67
00:04:51,120 --> 00:04:51,780
Right.

68
00:04:52,050 --> 00:04:54,380
And then we called editors that apply.

69
00:04:54,690 --> 00:05:00,990
So in this way we can actually put the animal types into are actually what cookies.

70
00:05:01,230 --> 00:05:07,490
And then we went to use that actually do not doesn't actually check these checkboxes.

71
00:05:07,670 --> 00:05:15,670
And and when he or she clicks on the OK here then it can actually provide a default animal type if it

72
00:05:15,670 --> 00:05:18,270
is actually wild animals for our quiz.

73
00:05:18,420 --> 00:05:19,200
Right.

74
00:05:19,290 --> 00:05:25,450
And the editors that apply and then we actually should host a message to the users show so toast that

75
00:05:25,690 --> 00:05:27,870
taste and we pass the context.

76
00:05:27,870 --> 00:05:29,230
Main activity that this.

77
00:05:29,340 --> 00:05:32,780
And then we pass this message art drink a toast message.

78
00:05:32,940 --> 00:05:36,070
And now let's actually let's actually hold the comments on a keyboard.

79
00:05:36,150 --> 00:05:40,400
And if you are using I mean machine just hold the control on your keyboard and then click on this value

80
00:05:40,410 --> 00:05:40,930
here.

81
00:05:41,070 --> 00:05:42,390
As you can see it was the message.

82
00:05:42,440 --> 00:05:44,720
One type of animals must be selected.

83
00:05:44,820 --> 00:05:46,940
The default value is wild animals.

84
00:05:47,190 --> 00:05:50,150
And now let's actually go back into our main activity that java file.

85
00:05:50,340 --> 00:05:53,940
And here we are specifying the duration of this message.

86
00:05:54,150 --> 00:05:57,120
And then we call the show my feet on this object.

87
00:05:57,120 --> 00:05:59,010
So now as you can see here.

88
00:05:59,550 --> 00:06:02,500
Let's actually look at this ELSE IF statement as you can see here.

89
00:06:02,640 --> 00:06:07,620
We checked this if statement for the keys that are equal to guesses.

90
00:06:07,740 --> 00:06:13,320
We actually take these as if statements for the keys that are equal to an animal type animal type as

91
00:06:13,320 --> 00:06:14,010
you can see here.

92
00:06:14,040 --> 00:06:19,500
After the curly brace of this key as you can see here after the end in calibers of this ELSE IF statement

93
00:06:19,770 --> 00:06:23,310
right we actually created another Else statement here.

94
00:06:23,490 --> 00:06:25,660
So else if that equals.

95
00:06:25,890 --> 00:06:27,020
Underline it.

96
00:06:27,180 --> 00:06:33,480
So here we are taking that up whenever the user for example is changing they're actually the front of

97
00:06:33,480 --> 00:06:35,550
the application as you can see here.

98
00:06:35,550 --> 00:06:43,020
So whenever the user clicks on these forms for queries and when he or she changes one of these or when

99
00:06:43,020 --> 00:06:46,020
he or she changes they quit the front of the quiz.

100
00:06:46,020 --> 00:06:49,750
So for example chant 5 and now it says new changes are applied.

101
00:06:49,770 --> 00:06:53,660
And now if I go back as you can see here the phone is changed right.

102
00:06:53,850 --> 00:07:01,980
So else if that equals cuius underlined font then we call this object my animalcules fragment that modified

103
00:07:01,980 --> 00:07:08,450
cuius font shirt preferences and then we refer to this object my animalcules phone that reset animal

104
00:07:08,480 --> 00:07:10,150
quits right.

105
00:07:10,260 --> 00:07:14,670
And then as you can see here you are actually creating another as if statement.

106
00:07:14,670 --> 00:07:20,390
So this LCP statement is full of and the user actually changes the baculum color of the quiz.

107
00:07:20,440 --> 00:07:25,320
So elf if cheap that equals Q is underlined by going on Underland color.

108
00:07:25,320 --> 00:07:30,030
Then again we refer to the name of this fragment object as you can see my animal quest for argument

109
00:07:30,300 --> 00:07:36,210
that modified by going on colored shed fences as you can see here this object is an object that he created

110
00:07:36,210 --> 00:07:38,530
from this classman activity fragments right.

111
00:07:38,670 --> 00:07:43,980
And by creating an object from this class we can actually access the methods that are inside of this

112
00:07:43,980 --> 00:07:45,420
main activity fragment class.

113
00:07:45,540 --> 00:07:48,660
And that's why you can see that we can call these methods here right.

114
00:07:48,660 --> 00:07:52,100
So you already know about this stuff.

115
00:07:52,380 --> 00:07:57,780
I actually talked about these are classes and object oriented programming.

116
00:07:58,010 --> 00:08:01,670
And when I actually taught you the Java programming language.

117
00:08:01,890 --> 00:08:07,570
So my quest for argument that modified by Canonical of shirt preferences and my animal cuius for that

118
00:08:07,580 --> 00:08:09,550
the recent animal is right.

119
00:08:10,050 --> 00:08:16,320
And here finally we are actually showing our Toastmaster the user Sotos that make just make text the

120
00:08:16,320 --> 00:08:22,110
main activity that these are that string that TOSed message as I can see here we are actually referring

121
00:08:22,110 --> 00:08:23,570
to this text message.

122
00:08:23,580 --> 00:08:33,520
So now let's get you to change this toaster message to actually change change message bright and then

123
00:08:33,550 --> 00:08:37,690
as you can see we are actually specifying the duration of these Toastmasters and then we are calling

124
00:08:37,690 --> 00:08:39,830
this Shoma if an undisclosed object.

125
00:08:39,850 --> 00:08:44,920
So now as you can see here we haven't still provided us an Austrian resource for this change message.

126
00:08:44,920 --> 00:08:51,320
So now let's actually just copy disvalue here and now let's actually go inside our strings that exemplified.

127
00:08:51,520 --> 00:08:58,350
And here let's create a string of stores and for the name just paste that value here change underline

128
00:08:58,360 --> 00:09:00,180
message and enclose this tag.

129
00:09:00,340 --> 00:09:04,010
And for the value just type in here it changes and new changes

130
00:09:07,190 --> 00:09:08,240
are applied.

131
00:09:10,370 --> 00:09:10,950
Right.

132
00:09:11,360 --> 00:09:14,640
And now let's actually go back into the main activity that double file.

133
00:09:14,790 --> 00:09:17,180
And now as you can see here the error is gone.

134
00:09:17,320 --> 00:09:18,520
Right.

135
00:09:18,520 --> 00:09:21,280
So hopefully that makes sense.

136
00:09:21,640 --> 00:09:26,210
As you can see here let's look at this here again unshelled friends change Meffert.

137
00:09:26,380 --> 00:09:30,680
We actually assign the value true for settings changed boolean variable.

138
00:09:30,820 --> 00:09:36,190
We are checking that if the user actually interacted with these guesses here with a number of guesses

139
00:09:36,190 --> 00:09:39,400
options as you can see here then we are going to execute this line of.

140
00:09:39,520 --> 00:09:46,600
These lines of code here first we can actually modify animal rules based on the users actually choose

141
00:09:46,600 --> 00:09:52,450
based off based on the users number of guesses options as you can see here for example the user wants

142
00:09:52,450 --> 00:09:58,350
to actually have a Fargus options or maybe the user wants to have sex gives options.

143
00:09:58,360 --> 00:10:05,170
So based on these decisions based on these values we're going to actually change the number of options

144
00:10:05,170 --> 00:10:07,300
that we have inside our quiz.

145
00:10:07,330 --> 00:10:08,020
Right.

146
00:10:08,370 --> 00:10:13,540
And now as you can see here we are here we have this statement and we are checking that if that user

147
00:10:13,810 --> 00:10:16,940
has actually interacted with the animals type as you can see here.

148
00:10:17,080 --> 00:10:23,280
So if you have two checkboxes here and we have also these at if and if else statement here Enceladus

149
00:10:23,410 --> 00:10:28,300
LCF statement that you can see in order to check that the user has actually checked at least one of

150
00:10:28,300 --> 00:10:30,860
these checkboxes or when you went to use that.

151
00:10:30,870 --> 00:10:35,580
For example did not text actually of one of these checkboxes as you can see here.

152
00:10:35,590 --> 00:10:42,140
So if are actually controlling these decisions here as you can see here and here we have this.

153
00:10:42,140 --> 00:10:42,520
Else.

154
00:10:42,570 --> 00:10:48,520
Else if statement for them and they use that actually changes the format of the of the taste of the

155
00:10:48,520 --> 00:10:51,370
patents that we have inside our coolies as you can see here.

156
00:10:51,370 --> 00:10:57,340
So if we call my animalcules for arguments that modify cuius font shirt and says My animalcules for

157
00:10:57,340 --> 00:11:03,850
argument that reset animalcules and then we have this Ellis statement that equals It is underlined by

158
00:11:03,980 --> 00:11:06,150
an underlined color as you can see here.

159
00:11:06,310 --> 00:11:07,900
So it does Elsy statement.

160
00:11:07,900 --> 00:11:13,380
Here is what I actually when the it changes the background color of this application.

161
00:11:13,390 --> 00:11:18,910
As you can see here the back uncolored of this quis and we actually calling that we are actually calling

162
00:11:18,910 --> 00:11:19,550
these methods.

163
00:11:19,590 --> 00:11:22,260
And this my animal Ahlquist Fleischman object.

164
00:11:22,490 --> 00:11:27,540
And we are finally set the reset in the quiz my animal quiz fragments that roosted animal quiz.

165
00:11:27,820 --> 00:11:33,910
And finally we are actually showing this message to the user to toast the toast that makes toast main

166
00:11:33,910 --> 00:11:39,740
activity that these are that string that change underlying message tostada letter short that shock.

167
00:11:40,060 --> 00:11:44,680
And now let's you to go inside our uncreate Smurfette here.

168
00:11:44,740 --> 00:11:45,650
As you can see.

169
00:11:45,820 --> 00:11:51,100
So now let's actually I'm going to get need to actually to paste in some more lines of code here.

170
00:11:51,400 --> 00:11:57,190
Because when the application is started up Vinita and when the uncreate Meffert is actually called we

171
00:11:57,190 --> 00:12:02,560
need to actually get some of those changes that we actually saved to the shared preferences and we need

172
00:12:02,560 --> 00:12:04,690
to actually apply them to our quiz.

173
00:12:04,750 --> 00:12:08,060
So for example now back in uncolored is yellow.

174
00:12:08,080 --> 00:12:08,400
Right.

175
00:12:08,410 --> 00:12:12,030
And if I click on this by here as you can see we have six Yes options right.

176
00:12:12,190 --> 00:12:15,630
And if we actually close this application here.

177
00:12:16,030 --> 00:12:21,100
Now let me close these applications and if you want to actually open this application here again as

178
00:12:21,100 --> 00:12:26,170
you can see we need to actually get those changes from the shared preferences here because at this time

179
00:12:26,170 --> 00:12:30,670
the uncreate method is going to be called and we need to actually get those changes that is saved to

180
00:12:30,670 --> 00:12:32,000
the shared preferences.

181
00:12:32,020 --> 00:12:34,670
So now I'm going to paste in some lines of code here.

182
00:12:34,670 --> 00:12:39,790
Inside is uncreate Smurfette inside the main activity class and then I'm going to explain to you of

183
00:12:39,790 --> 00:12:41,130
what's going on here.

