1
00:00:00,360 --> 00:00:07,800
So now as you can see here we have an actually of Ordnung here and it says many items should specify

2
00:00:07,800 --> 00:00:14,880
a title and this means that if our application is not actually able to load this vector image it is

3
00:00:14,880 --> 00:00:20,540
going to actually load this title for our menu option for our menu button.

4
00:00:20,550 --> 00:00:26,140
So let's actually specify at hightails So here I can just type in title and then I can choose this attribute.

5
00:00:26,250 --> 00:00:32,190
And here I can just say that the title is going to be settings or who is sitting.

6
00:00:33,240 --> 00:00:37,180
OK so now as you can see here the warning is gone.

7
00:00:37,350 --> 00:00:40,590
And now let's actually create our preferences file.

8
00:00:40,590 --> 00:00:42,090
Inside our project.

9
00:00:42,090 --> 00:00:46,280
So now just a selectees rest folder here.

10
00:00:46,380 --> 00:00:52,450
Right click on it new and then just selectees and roit resource directory and read the source file.

11
00:00:52,470 --> 00:00:54,690
Excuse me just excuse me.

12
00:00:54,690 --> 00:00:57,560
Let's actually move through this process again.

13
00:00:57,600 --> 00:01:02,160
Right click on these arrests for the new and then choose Android resource wide.

14
00:01:02,320 --> 00:01:02,890
OK.

15
00:01:03,000 --> 00:01:11,240
And for the name just type in here cuius underline preferences.

16
00:01:11,650 --> 00:01:12,120
OK.

17
00:01:12,220 --> 00:01:14,230
Is underlined preferences.

18
00:01:14,610 --> 00:01:21,550
And now for to actually for the resource type choose ASML as you can see here.

19
00:01:21,630 --> 00:01:24,440
And as you can see here the root element is preference.

20
00:01:24,450 --> 00:01:29,170
Screen the source said is main and the directory name is exit right.

21
00:01:29,330 --> 00:01:29,910
And actually.

22
00:01:29,940 --> 00:01:30,620
OK.

23
00:01:31,140 --> 00:01:37,560
As you can see here now we have a new directory called ASML and we have this quiz underline preferences

24
00:01:37,560 --> 00:01:38,420
that example.

25
00:01:38,610 --> 00:01:42,250
So this image here is actually it like an activity.

26
00:01:42,420 --> 00:01:44,600
And now let me show you what this does here.

27
00:01:44,820 --> 00:01:48,500
So now let me open the emulator here.

28
00:01:48,500 --> 00:01:49,490
Disqus application.

29
00:01:49,500 --> 00:01:55,170
And now if we click on this a setting button here as you can see now this activity is open.

30
00:01:55,170 --> 00:02:01,080
Right here you can see these options and this activity is this one right this is the preferences.

31
00:02:01,110 --> 00:02:07,320
We can actually use these options in order to specify and in order to specify the actually the settings

32
00:02:07,320 --> 00:02:08,530
of our application.

33
00:02:08,610 --> 00:02:14,610
For example the types of animal that you want to be used inside Yamla inside the keys for example the

34
00:02:14,610 --> 00:02:20,070
number of cases that you choose by given color for example I can specify the background color for example

35
00:02:20,100 --> 00:02:20,910
black.

36
00:02:21,330 --> 00:02:27,540
And then I can specify the quarries the front of our Barkleys application as you can see here the text

37
00:02:27,870 --> 00:02:33,330
of our buttons as you can see here are all going to be if their phones are going to be changed according

38
00:02:33,330 --> 00:02:35,090
to these phones.

39
00:02:35,430 --> 00:02:40,860
Now if I actually click on dispatch button here as you can see here the background color is black.

40
00:02:41,040 --> 00:02:41,960
Right.

41
00:02:42,000 --> 00:02:44,310
So hopefully that makes sense.

42
00:02:44,330 --> 00:02:46,730
And now let's actually go inside this quiz.

43
00:02:46,890 --> 00:02:49,480
Go inside these quis briefness is that exemplified.

44
00:02:49,830 --> 00:02:55,710
And then click on a text here at the bottom as you can see we have this design tab and we have this

45
00:02:55,980 --> 00:02:58,510
text tab here at the bottom right.

46
00:02:58,530 --> 00:03:05,400
So just select it takes tab and now let's actually double click on the squeeze on the line preferences

47
00:03:05,400 --> 00:03:12,150
that XML file as you can see here just double click on these tab in order to make this area wider and

48
00:03:12,180 --> 00:03:18,090
inside his preference screen as you can see we can put our own logic here for the settings activity.

49
00:03:18,240 --> 00:03:23,610
So now I'm going to paste them some lines of code here and then I'm going to explain to you what's going

50
00:03:23,610 --> 00:03:24,430
on here.

51
00:03:24,750 --> 00:03:28,900
So as you can see here these are the lines of code that I pasted here.

52
00:03:28,920 --> 00:03:29,440
Right.

53
00:03:29,440 --> 00:03:36,210
If you have a list preference and as you can see here the entries are number of guesses list and the

54
00:03:36,260 --> 00:03:41,990
entry values are again a number of cases least we had which we haven't provided the values yet and that

55
00:03:42,000 --> 00:03:45,350
he is setting's underline number of guesses.

56
00:03:45,570 --> 00:03:48,810
And as you can see here the title is number of guesses title.

57
00:03:48,810 --> 00:03:51,120
So we have our strange resource.

58
00:03:51,120 --> 00:03:54,830
So let's actually open our emulator in order to show you this here.

59
00:03:54,840 --> 00:03:55,860
So just click on this.

60
00:03:55,860 --> 00:04:01,620
If I actually click on the settings here as you can see now I am actually creating this list here I

61
00:04:01,620 --> 00:04:07,590
am creating this option here number of guesses as you can see the title is number of guesses and we

62
00:04:07,590 --> 00:04:08,620
have this description.

63
00:04:08,620 --> 00:04:11,680
Show two four or six guess options.

64
00:04:11,730 --> 00:04:17,010
As you can see here this is the description and if I click on it as you can see we have these entries

65
00:04:17,280 --> 00:04:22,400
so the entries as you can see here are the values that we are going to show to the user.

66
00:04:22,530 --> 00:04:28,250
OK those entries are actually only useful for showing them to the user.

67
00:04:28,380 --> 00:04:31,060
So for example we have 2 4 6.

68
00:04:31,110 --> 00:04:37,680
So we're going to show those values to 4 6 through the user and we have also entry values which is very

69
00:04:37,680 --> 00:04:38,450
important.

70
00:04:38,490 --> 00:04:42,270
This is going to be these values are going to be the actual values.

71
00:04:42,270 --> 00:04:49,030
So again because we are just specifying the number of desires we can use the entries or into the values

72
00:04:49,060 --> 00:04:50,220
into these values the same.

73
00:04:50,220 --> 00:04:55,810
So 2 4 6 and the key is actually setting underline number of cases.

74
00:04:55,810 --> 00:05:03,180
So it is very important that we specify a key for our least preference here because of it when we are

75
00:05:03,180 --> 00:05:10,470
actually coding our application inside our main activity that Java or other dhaba files we must actually

76
00:05:10,620 --> 00:05:14,100
use this key in order to reverse this list preference.

77
00:05:14,520 --> 00:05:18,770
So this is really important that you actually provide Actually this is like an ID.

78
00:05:18,950 --> 00:05:19,610
OK.

79
00:05:19,890 --> 00:05:21,210
And if you have a title.

80
00:05:21,210 --> 00:05:25,310
So I already talked about this title so if I clicked on this cancel here.

81
00:05:25,350 --> 00:05:31,350
Now you can see this is the total number of guesses and show two four or six just options.

82
00:05:31,350 --> 00:05:33,140
This is actually the description.

83
00:05:33,300 --> 00:05:39,890
So as you can see this is the sum of the attributes and we have this persistent attribute So what is

84
00:05:39,890 --> 00:05:44,510
this persistent attribute this persistent attribute is going to determine for example if I actually

85
00:05:44,900 --> 00:05:45,290
said it.

86
00:05:45,290 --> 00:05:48,060
Number four here number of cases is 4.

87
00:05:48,350 --> 00:05:53,450
As you can see this if you click on dispatch button here now as you can see the number of cases are

88
00:05:53,450 --> 00:05:54,400
four right.

89
00:05:54,440 --> 00:06:01,190
And this persistent attribute is going to help to save these settings to the shared preferences.

90
00:06:01,190 --> 00:06:04,240
So for example if they actually delete.

91
00:06:04,310 --> 00:06:10,340
For example if I close this application and now if I want to for example open this application here

92
00:06:10,400 --> 00:06:15,490
again as you can see here but this is that application right.

93
00:06:15,740 --> 00:06:19,280
And now as you can see the settings are actually saved.

94
00:06:19,610 --> 00:06:26,390
And that's the job of this persistent attribute this persistent attribute is going to actually save

95
00:06:26,390 --> 00:06:32,570
those settings to the shared preferences so that whenever an application is actually run or running

96
00:06:32,870 --> 00:06:40,800
for the for the next time you can actually read those values to settings from the shared preferences.

97
00:06:40,800 --> 00:06:49,610
So this is very important that you specify a persistent attribute for your Actually for your list programs

98
00:06:49,640 --> 00:06:52,580
or other components inside this preference screen.

99
00:06:52,840 --> 00:06:53,390
OK.

100
00:06:53,440 --> 00:06:58,880
Because it's going to actually save these settings to the shared preferences.

101
00:06:59,120 --> 00:07:01,000
So true persistent true.

102
00:07:01,280 --> 00:07:07,820
And we have our default values so if we don't actually provide our value for our For example number

103
00:07:07,820 --> 00:07:11,060
of cases the default value is going to be number four right.

104
00:07:11,210 --> 00:07:12,630
So the default value is four.

105
00:07:12,880 --> 00:07:18,670
And now we need to actually provide some values for the entries and the values title and summary inside

106
00:07:18,670 --> 00:07:22,390
there for example at a resources or for example is resources.

107
00:07:22,670 --> 00:07:25,390
So now let's actually open our project structure.

108
00:07:25,610 --> 00:07:33,930
So now just click on View tool windows and then click on project and then here inside these values folder.

109
00:07:34,010 --> 00:07:38,240
Just double click on these strings that they send here as you can see.

110
00:07:38,270 --> 00:07:43,970
And now let's actually pro-white some string resources here that actually provide some string values

111
00:07:44,240 --> 00:07:46,110
here and here.

112
00:07:46,190 --> 00:07:50,930
Let's actually go inside the squeeze underline preferences that is him here.

113
00:07:50,960 --> 00:07:52,980
Again as you can see here.

114
00:07:53,120 --> 00:07:56,450
The first one is the total number of guesses total right.

115
00:07:56,450 --> 00:08:00,770
So let's actually copy this value a number of guesses title.

116
00:08:01,190 --> 00:08:08,040
And now let's actually go again inside the streams that exemplified and actually create a string the

117
00:08:08,180 --> 00:08:08,670
here.

118
00:08:08,750 --> 00:08:11,700
And the name is going to be number of cases title.

119
00:08:11,930 --> 00:08:18,860
And now let's actually close this tag and here for this string resource I can actually provide the value

120
00:08:19,810 --> 00:08:20,420
here.

121
00:08:20,420 --> 00:08:23,440
Let's actually open our emulator as you can see here.

122
00:08:23,540 --> 00:08:25,640
The title is number of guesses right.

123
00:08:25,640 --> 00:08:35,170
So here again to say PIN number number of guesses number of guesses.

124
00:08:35,300 --> 00:08:35,930
Right.

125
00:08:36,030 --> 00:08:41,920
So now let's actually go again inside this quiz quiz underlying preferences are the example.

126
00:08:42,120 --> 00:08:46,020
And here we have another string value number of guesses description.

127
00:08:46,020 --> 00:08:52,860
So let's copy this value here and now let's actually go inside the string that is modified.

128
00:08:52,950 --> 00:08:56,530
And here let's actually create another string rissoles.

129
00:08:56,640 --> 00:08:57,850
So strange.

130
00:08:58,170 --> 00:09:03,900
And for the name just paste that value here a number of cases description and then close the stack here.

131
00:09:04,190 --> 00:09:08,500
So now I actually double click on the tab here in order to make his area wider.

132
00:09:08,880 --> 00:09:12,130
So far the value is actually open or emulator again here.

133
00:09:12,150 --> 00:09:19,250
So the value so for the description as you can see here is just typing show two four or six just options.

134
00:09:19,260 --> 00:09:31,210
So here I can just type in schul to 4 or six gifts options right.

135
00:09:31,210 --> 00:09:37,660
This is going to be the description the Samadi as you can see here and now let's actually go again inside

136
00:09:37,660 --> 00:09:40,490
the squeeze underline preferences that is the.

137
00:09:40,510 --> 00:09:41,480
As you can see here.

138
00:09:41,710 --> 00:09:46,400
Now the arrow is gone and we also need to provide some values here.

139
00:09:46,750 --> 00:09:50,650
As you can see at sign at a slash number of guesses at least.

140
00:09:50,710 --> 00:09:54,640
And as you can see here Vidi to actually provide another example right here.

141
00:09:54,640 --> 00:09:56,830
So let's open our project structure.

142
00:09:56,830 --> 00:09:59,920
So just click on this view tool windows project.

