1
00:00:00,450 --> 00:00:05,020
So now I'm going to paste in some lines of code here inside this class.

2
00:00:05,040 --> 00:00:09,420
So before the end in calibers of this class I'm going to paste in some lines of code and then I'm going

3
00:00:09,420 --> 00:00:12,590
to explain to you what's going on here.

4
00:00:12,630 --> 00:00:18,660
So as you can see here these are the lines of code that I pasted here and now as you can see this is

5
00:00:18,660 --> 00:00:19,590
actually a method.

6
00:00:19,800 --> 00:00:27,030
So public voit as you can see the access modify it is Popbitch the return type of the Smurfette is void

7
00:00:27,390 --> 00:00:31,740
and the name of this method is modify each type of inquiries.

8
00:00:31,980 --> 00:00:37,920
So as you can see this bifurcation accepts an argument of type shared preferences and the name of this

9
00:00:38,010 --> 00:00:40,010
argument is shared preferences.

10
00:00:40,500 --> 00:00:42,990
And as you can see are actually opened and closed.

11
00:00:42,990 --> 00:00:45,080
This effort by using these curly braces.

12
00:00:45,090 --> 00:00:49,800
So now let's actually go inside the curly braces of this method and let's see what's going on here.

13
00:00:49,800 --> 00:00:56,810
So first of all let me tell you that the purpose of this method is to actually modify the type of animals

14
00:00:56,820 --> 00:00:58,810
that you want to have inside our quiz.

15
00:00:58,890 --> 00:01:03,430
So now let me show you the emulator as you can see it this is our emulator.

16
00:01:03,430 --> 00:01:07,780
And for example now we can actually play with Disqus here.

17
00:01:07,890 --> 00:01:10,840
But now let's let's actually go inside the settings activity.

18
00:01:11,040 --> 00:01:14,080
And now here as you can see we have this item animals right.

19
00:01:14,130 --> 00:01:16,980
So just click on it and here.

20
00:01:17,010 --> 00:01:24,210
Let's actually assume that I want to only have wild animals inside my quiz so I just need to check these

21
00:01:24,300 --> 00:01:26,710
wild animals here as you can see.

22
00:01:26,920 --> 00:01:31,860
And now I just need to click on OK and then actually click on back here.

23
00:01:32,910 --> 00:01:38,820
As you can see here now the quiz is going to have only actually wild animals.

24
00:01:38,820 --> 00:01:41,240
So for example this is actually a leopard.

25
00:01:41,700 --> 00:01:44,480
And now the next image is going to be again a wild animal.

26
00:01:44,480 --> 00:01:47,230
For example this is a dog right.

27
00:01:47,250 --> 00:01:54,150
So now as you can see by actually changing the settings and actually changing the type of animals that

28
00:01:54,240 --> 00:02:00,520
you want to have in say the quiz we can actually determine the type of animals that we can have inside

29
00:02:00,520 --> 00:02:01,340
the squeeze.

30
00:02:01,380 --> 00:02:03,630
So that's the purpose of this method here.

31
00:02:03,750 --> 00:02:09,380
When I actually change the type of the animals here as you can see this Mfat here is going to be called.

32
00:02:09,510 --> 00:02:13,920
So now as you can see let's actually go inside the curly braces of the Smurfette.

33
00:02:14,040 --> 00:02:22,240
So first as you can see I actually fed to this this valuable animal types inquiries so analysis should

34
00:02:22,270 --> 00:02:23,690
go inside our class.

35
00:02:23,690 --> 00:02:25,760
Let's scroll to the top of the file here.

36
00:02:26,030 --> 00:02:33,110
As you can see we actually created this set here as you can see this is actually a set of string values

37
00:02:33,620 --> 00:02:37,040
and the name of our set is animal types in quiz.

38
00:02:37,250 --> 00:02:39,910
So not essentially just add up.

39
00:02:40,310 --> 00:02:42,550
Let's actually look at this line of code here.

40
00:02:42,560 --> 00:02:44,040
He had actually said right.

41
00:02:44,060 --> 00:02:50,150
I told you about it before that sets cannot have duplicated values right.

42
00:02:50,180 --> 00:02:56,240
So now as you can see let's scroll down here and let's actually go back into our method here.

43
00:02:56,270 --> 00:02:57,070
As you can see here.

44
00:02:57,080 --> 00:03:00,950
So animal types inquiries assignment operator.

45
00:03:00,950 --> 00:03:03,830
So here I am actually initializing this set.

46
00:03:03,830 --> 00:03:04,330
Right.

47
00:03:04,490 --> 00:03:11,960
So here I am referring to this share's preferences argument that I get from Smurfette does get strength

48
00:03:11,960 --> 00:03:12,300
set.

49
00:03:12,320 --> 00:03:16,490
So as you can see here I am calling this method get string set.

50
00:03:16,520 --> 00:03:21,260
So by calling the smith and I can actually get a set of string values.

51
00:03:21,260 --> 00:03:28,670
So now let's scroll to the top of the file here as you can see we actually have actually a set of string

52
00:03:28,670 --> 00:03:33,440
values as you can see here a set of string values and the name is animal types in quotes.

53
00:03:33,590 --> 00:03:35,820
So now let's scroll down here.

54
00:03:36,620 --> 00:03:39,980
As you can see I am actually calling this method get string set.

55
00:03:39,980 --> 00:03:44,060
So this Smurfette is going to give us a set of values.

56
00:03:44,210 --> 00:03:47,930
So for the arguments as you can see here we need to specify the key.

57
00:03:47,930 --> 00:03:52,820
So the key is main activity that animals underline type.

58
00:03:52,970 --> 00:03:58,010
And now it's actually legal in say the main activity file here as you can see inside this main activity

59
00:03:58,010 --> 00:04:00,210
class in line number 17.

60
00:04:00,230 --> 00:04:02,550
I actually created this constant here.

61
00:04:02,720 --> 00:04:03,430
Right.

62
00:04:03,470 --> 00:04:07,140
And as you can see the data type is strengthen Aimee's.

63
00:04:07,280 --> 00:04:09,520
Underline type assignment operator.

64
00:04:09,620 --> 00:04:14,870
And inside the double quotes you can see that we put these values settings underline animal type.

65
00:04:14,900 --> 00:04:20,570
So this is the key that is specified inside the squeeze on the left preferences that example as you

66
00:04:20,570 --> 00:04:21,470
can see here.

67
00:04:21,470 --> 00:04:26,630
So here we have actually a multi-select a multi-select list preference as you can see.

68
00:04:26,780 --> 00:04:32,630
So now you can see that the entries are type of animals the interest values as you can see here type

69
00:04:32,630 --> 00:04:33,990
of animals values.

70
00:04:34,010 --> 00:04:39,910
So let's actually hold the Comanche on a keyboard and then click on these entries here as you can see

71
00:04:39,920 --> 00:04:41,570
this is actually the entries.

72
00:04:41,630 --> 00:04:46,310
So these values are the values that we are going to show to the user right.

73
00:04:46,340 --> 00:04:48,860
Wild animals or tame animals.

74
00:04:49,070 --> 00:04:52,700
And if I show you the emulator as you can see these are the two values.

75
00:04:52,790 --> 00:04:54,710
Wild animals or tame animals.

76
00:04:54,830 --> 00:05:00,380
And let's actually go back into our quiz Underland preferences that exemplified and we have also into

77
00:05:00,380 --> 00:05:01,190
values.

78
00:05:01,190 --> 00:05:06,220
So these three values are the actual values that we are going to work with here.

79
00:05:06,230 --> 00:05:12,440
As you can see so I actually hold the comments on my keyboard and then I clicked on that and three values.

80
00:05:12,440 --> 00:05:14,530
And here is here is the radius right.

81
00:05:14,600 --> 00:05:17,900
You can see that a type of animals values.

82
00:05:18,080 --> 00:05:22,140
And as you can see white underline any mouse or paint on the animals.

83
00:05:22,280 --> 00:05:26,340
So these are the values that we are going to work with from our job coats.

84
00:05:26,510 --> 00:05:27,700
So let's go back into our quiz.

85
00:05:27,720 --> 00:05:34,480
Underland preferences that exemplified and here you can see that the key is settings underline and impulse

86
00:05:34,490 --> 00:05:35,250
type.

87
00:05:35,270 --> 00:05:40,910
So I created this key here so that I can actually interact with this multi-select this preference from

88
00:05:40,910 --> 00:05:41,430
my job.

89
00:05:41,450 --> 00:05:45,670
Cote's so inciters main activity here main activity of a fight.

90
00:05:45,710 --> 00:05:51,890
I actually created this key here and then I assigned this key to this constant so that when ever I want

91
00:05:51,890 --> 00:05:55,580
to use this key I can actually refer just to this name here.

92
00:05:55,580 --> 00:05:59,730
Animals on the type Smain activity that animals underling type.

93
00:05:59,780 --> 00:06:05,600
So if I go back into our Actually main activity fragment of the Java file as you can see inside this

94
00:06:05,600 --> 00:06:11,480
class I actually passed this key so that I can actually get this string set here as you can see main

95
00:06:11,480 --> 00:06:13,890
activity that animals type.

96
00:06:14,270 --> 00:06:17,040
And for the default value I passed the value null.

97
00:06:17,090 --> 00:06:17,590
Why.

98
00:06:17,660 --> 00:06:24,110
Because inside the underlying preferences that exemplified I actually specified a default value for

99
00:06:24,110 --> 00:06:26,920
this multi select list preference as you can see here.

100
00:06:26,990 --> 00:06:28,630
Right.

101
00:06:28,830 --> 00:06:32,450
Value is an assignment operator and instead of quotes at St..

102
00:06:32,450 --> 00:06:37,650
Address what this refers to the arrays that exemplified slash type of animals by the use.

103
00:06:37,790 --> 00:06:41,210
And if I hold that control if I hold the comment on my keyboard.

104
00:06:41,210 --> 00:06:45,710
So if you are using a Windows machine just hold the control key on your keyboard and then click on this

105
00:06:45,720 --> 00:06:46,580
value here.

106
00:06:46,820 --> 00:06:51,670
As you can see this is actually the default value type of animals values.

107
00:06:51,710 --> 00:06:53,900
So he's going to use these values here.

108
00:06:53,900 --> 00:06:54,410
Right.

109
00:06:54,470 --> 00:06:59,030
Wild Underland animals or tame Underland and tame underline animals.

110
00:06:59,060 --> 00:07:04,000
So by default both of these types are going to be included in say the keys.

111
00:07:04,100 --> 00:07:04,880
Right.

112
00:07:04,910 --> 00:07:10,500
So for the first time that they use that is actually has installed this application on his or her device.

113
00:07:10,610 --> 00:07:16,480
They can actually see both vile animals and tame animals inside a quiz as you can see here.

114
00:07:16,820 --> 00:07:17,520
Right.

115
00:07:18,040 --> 00:07:21,320
So hopefully that makes sense.

116
00:07:21,490 --> 00:07:26,420
Now let's actually go back into our Actually main activity fragment that of a file.

117
00:07:26,800 --> 00:07:32,530
And here you can see that we are actually getting this thing set here from this key main activity that

118
00:07:32,590 --> 00:07:33,550
animals type.

119
00:07:33,610 --> 00:07:39,330
And for the default value I-PASS the value null and of assigning that string set to these animal types

120
00:07:39,340 --> 00:07:40,850
inquiries valuable.

121
00:07:40,930 --> 00:07:41,470
Right.

122
00:07:41,710 --> 00:07:44,750
So now that's enough for the Smurfette.

123
00:07:44,950 --> 00:07:45,540
OK.

124
00:07:45,610 --> 00:07:49,600
So let's actually I'm going to add some more lines of code here for other functions.

125
00:07:49,600 --> 00:07:54,490
So as you can see if I show you the emulator and if I go to the settings activity as you can see here

126
00:07:54,760 --> 00:07:58,260
we need to provide some logic for this to get on color.

127
00:07:58,270 --> 00:08:03,730
So for example when the user selects the bike it uncolored B to B.

128
00:08:03,730 --> 00:08:05,390
For example white.

129
00:08:05,830 --> 00:08:10,280
And when they click on dispatch button here as you can see now that baculum color is white.

130
00:08:10,360 --> 00:08:11,180
Right.

131
00:08:11,220 --> 00:08:14,740
And they can actually just the animal here.

132
00:08:14,740 --> 00:08:19,480
So let's actually go back into our Android studio and let's actually go inside this class.

133
00:08:19,680 --> 00:08:21,100
Main activity fragment class.

134
00:08:21,100 --> 00:08:26,230
So before the end in curly brace of this class you're going to pay some lines of code and then I'm going

135
00:08:26,230 --> 00:08:28,330
to explain to you what's going on here.

