1
00:00:00,330 --> 00:00:06,030
So in our project structure just click on this package here inside this Java folder.

2
00:00:06,030 --> 00:00:13,020
Click on this package right click on it new and for the name just type in here for the new and select

3
00:00:13,050 --> 00:00:18,150
this job class and for the name of your Java class just they've been here.

4
00:00:18,580 --> 00:00:20,890
France's activity

5
00:00:23,560 --> 00:00:25,040
and then click on OK.

6
00:00:25,240 --> 00:00:32,170
So here as you can see I have this class here and this class here these preferences activity needs to

7
00:00:32,230 --> 00:00:37,970
extend needs to actually extend from the France activity.

8
00:00:38,320 --> 00:00:43,540
In our Android preferences as you can see here Android that preference that preferences that preference

9
00:00:43,540 --> 00:00:48,880
activity this is really important because we want to actually create a preference activity in order

10
00:00:48,880 --> 00:00:54,670
to let the user to actually change some settings we need to extend from the previous activity that we

11
00:00:54,670 --> 00:00:57,930
have inside this android that preference package.

12
00:00:57,970 --> 00:01:03,010
OK so now I can actually put my own logic here in this class.

13
00:01:03,010 --> 00:01:09,020
So the first thing that we need to do here is to actually overwrite the uncreate method.

14
00:01:09,220 --> 00:01:09,740
OK.

15
00:01:09,970 --> 00:01:12,740
So as you can see here we have this uncreate method.

16
00:01:12,760 --> 00:01:16,090
I just need to select it and then press Enter key on my keyboard.

17
00:01:16,110 --> 00:01:22,120
So here as you can see I am actually overwriting the uncreate method that we actually extend.

18
00:01:22,140 --> 00:01:26,430
We inherit that dismembers from this preference activity class.

19
00:01:26,740 --> 00:01:35,090
So inside this class Enceladus and create Smurfit I can just take an ad free France from resource.

20
00:01:35,300 --> 00:01:38,570
OK it is Lafferty's deprecated but you need to act as a developer.

21
00:01:38,740 --> 00:01:44,440
You need to know about these Misfit's because in the future you mean human actually can encounter some

22
00:01:44,440 --> 00:01:49,020
projects that actually use this method in order to get these up.

23
00:01:49,060 --> 00:01:55,940
For example many will find those that preference file that prevents a xml file from the resources.

24
00:01:56,140 --> 00:02:05,110
So here I can just type in our DOT exit mail dot preferences underline find as you can see here and

25
00:02:05,110 --> 00:02:12,210
here and just adding preferences here for this activity add preferences from resource are examples that

26
00:02:12,240 --> 00:02:14,440
preferences underline file.

27
00:02:14,540 --> 00:02:20,200
This is actually like the set content view Meffert that we actually like to put in our main activity

28
00:02:21,040 --> 00:02:26,830
class inside this uncreate if and as you can see in order to put this out file on our activity.

29
00:02:26,980 --> 00:02:32,620
Ok for example are that leave out an activity but for our preferences activity we need to use this Minford

30
00:02:33,040 --> 00:02:38,880
I add preferences from resource are that example that preferences file.

31
00:02:38,980 --> 00:02:39,590
OK.

32
00:02:39,820 --> 00:02:46,210
So in our main activity that java file here when the user clicks on these settings a button here as

33
00:02:46,210 --> 00:02:50,720
you can see on our emulator Let me show our emulator to you now.

34
00:02:50,740 --> 00:02:56,320
So here is our emulator and if I click on the menu button here you can see it is sitting here.

35
00:02:56,320 --> 00:03:01,780
So then I click on the settings here I want to actually move to the preferences activity and I want

36
00:03:01,780 --> 00:03:08,950
to actually open this a preference underline find that example in order to let the user see these checkbox

37
00:03:08,950 --> 00:03:11,590
preferences and this category and this list views.

38
00:03:11,640 --> 00:03:15,180
OK in this lawsuit that I created here this list preference.

39
00:03:15,280 --> 00:03:15,830
OK.

40
00:03:16,120 --> 00:03:19,730
So let's go back to our main activity that our file and inside this case statement.

41
00:03:19,840 --> 00:03:21,730
So when the user clicks on the sitting spot.

42
00:03:21,740 --> 00:03:23,800
And what do I want to happen.

43
00:03:23,800 --> 00:03:30,470
So here I just need to create an intent object so intent and the name of my object is intent.

44
00:03:30,500 --> 00:03:37,980
Assignment operator so here I want to instantiate this object new intent at inside Apprentice's.

45
00:03:38,030 --> 00:03:45,890
First I need to specify the first class main activity but this and I want to move to these preferences

46
00:03:45,920 --> 00:03:47,120
activity class right.

47
00:03:47,140 --> 00:03:54,650
So here I can just type in preferences activity class and then put a semicolon at the end of your statement.

48
00:03:54,970 --> 00:03:59,550
And here I can't just type in start activity intent.

49
00:03:59,870 --> 00:04:05,220
OK so now let's actually run our project and see what happens.

50
00:04:05,230 --> 00:04:09,760
So if we don't run our project now our application is going to actually crash when I want to actually

51
00:04:09,760 --> 00:04:14,740
move to the preferences activity and I want to show you why this happens.

52
00:04:14,740 --> 00:04:18,280
So as you can see here our application is running on dissimulated.

53
00:04:18,310 --> 00:04:19,840
And if we click on this menu here.

54
00:04:19,840 --> 00:04:24,520
Now you want to click on the settings here and as you can see here now our application has actually

55
00:04:24,520 --> 00:04:25,090
crashed.

56
00:04:25,090 --> 00:04:25,750
Why.

57
00:04:25,900 --> 00:04:31,810
Because in the Android manifest here as you can see in our project structure inside this manifest folder

58
00:04:31,840 --> 00:04:34,630
I have this android manifest that exemplified.

59
00:04:34,840 --> 00:04:42,440
So here inside our manifest we didn't actually put up this activity and activity tag for our preferences

60
00:04:42,460 --> 00:04:43,270
activity.

61
00:04:43,510 --> 00:04:50,620
So inside our application tag I need to actually open another task with the name activity and the name

62
00:04:50,620 --> 00:04:53,670
of this activity is going to be preferences activity.

63
00:04:53,680 --> 00:04:57,800
So remember this preferences activity is inside this default package here.

64
00:04:57,820 --> 00:04:58,280
OK.

65
00:04:58,330 --> 00:05:04,030
That example that is a site that that app number 51 so it doesn't select need to select this one here

66
00:05:04,300 --> 00:05:06,830
and that I need to close this attack here.

67
00:05:06,880 --> 00:05:07,440
OK.

68
00:05:07,720 --> 00:05:10,690
So let's run our project again and see what happens.

69
00:05:10,690 --> 00:05:15,270
So here as you can see our application is running on this emulator.

70
00:05:15,280 --> 00:05:20,140
And if I click on this menu in here and here I want to click on the settings here.

71
00:05:20,290 --> 00:05:27,990
Now I successfully move this activity here and now as you can see here it just takes a number of settings.

72
00:05:28,130 --> 00:05:32,370
So this I truly open our preferences underline for example here.

73
00:05:32,460 --> 00:05:34,100
Now you want to show you these values.

74
00:05:34,140 --> 00:05:39,570
So here I have this title takes number one sitting right and he had as you can see at the top it says

75
00:05:39,570 --> 00:05:40,840
text number one settings.

76
00:05:41,010 --> 00:05:43,830
This is the total of the preference category.

77
00:05:43,830 --> 00:05:44,930
Right.

78
00:05:45,000 --> 00:05:49,140
And here I have these checkboxes as you can see chunk five.

79
00:05:49,290 --> 00:05:51,600
This is the title as you can see here.

80
00:05:51,900 --> 00:05:58,000
And now as you can see here I have this subtitle here.

81
00:05:58,010 --> 00:05:59,480
This is number one.

82
00:05:59,480 --> 00:06:00,600
So this is the summary.

83
00:06:00,620 --> 00:06:04,060
As you can see here this is the description.

84
00:06:04,730 --> 00:06:08,980
And we also have this default value which is going to specify the font.

85
00:06:08,990 --> 00:06:14,190
And we have this checkbox here that we can get you to check or uncheck.

86
00:06:14,240 --> 00:06:15,290
Right.

87
00:06:15,560 --> 00:06:22,540
And we also have other text boxes Fauntleroy Brown and this checkbox wunderbar spaced them all right.

88
00:06:22,580 --> 00:06:28,070
And here as you can see we have this one specify the size of your forms for ticks view 1.

89
00:06:28,070 --> 00:06:32,170
So here this is our least preference as you can see here.

90
00:06:32,210 --> 00:06:38,240
So if I select this one here if I click on this one here now it's going to show us are some radio buttons.

91
00:06:38,240 --> 00:06:39,900
Choose one of these sizes.

92
00:06:39,980 --> 00:06:43,920
So here as you can see the title is as you can see it.

93
00:06:44,110 --> 00:06:45,470
Click on cancel here.

94
00:06:45,580 --> 00:06:47,080
The title is this value.

95
00:06:47,150 --> 00:06:51,720
Specify the size of your faults for text view of one as you can see here.

96
00:06:51,740 --> 00:06:54,610
This is the title and the date title is.

97
00:06:54,620 --> 00:06:59,610
If I click on it the dialog title is choose one of these sizes so that I like.

98
00:07:00,470 --> 00:07:08,810
And we have these entries and entry values as you can see here 25 the Piep 40 DP 45 dpi and these values.

99
00:07:08,870 --> 00:07:15,200
So inside are strings that exemplified here as you can see these are the values that are going to be

100
00:07:15,200 --> 00:07:16,960
shown to the user.

101
00:07:17,510 --> 00:07:19,970
And these are the actual values.

102
00:07:20,000 --> 00:07:20,480
OK.

103
00:07:20,560 --> 00:07:27,320
For 25 40 45 or other values that you may want to add or for example delete.

104
00:07:27,440 --> 00:07:28,210
OK.

105
00:07:28,520 --> 00:07:33,140
So in our project as you can see here in our application we have these values.

106
00:07:33,140 --> 00:07:37,310
It is very important that you actually put these string values here.

107
00:07:37,340 --> 00:07:37,900
OK.

108
00:07:38,180 --> 00:07:41,470
This of font sizes and font sizes values OK.

109
00:07:41,810 --> 00:07:44,090
And it's going to try to show these values to the user.

110
00:07:44,090 --> 00:07:48,440
So now for example I don't want to actually show these deep keys to the user.

111
00:07:48,440 --> 00:07:48,730
OK.

112
00:07:48,740 --> 00:07:50,940
I don't want to I don't like this deep here.

113
00:07:51,080 --> 00:07:54,230
So here I just need to delete this DP here.

114
00:07:54,230 --> 00:07:54,750
OK.

115
00:07:54,890 --> 00:07:57,960
These are the values that are going to be shown to the user.

116
00:07:58,340 --> 00:07:59,170
OK.

117
00:07:59,330 --> 00:08:04,840
So for example here Depay and delete this one this font and this one.

118
00:08:04,850 --> 00:08:06,090
And finally this one.

119
00:08:06,230 --> 00:08:09,620
So let's run our project again and see what happens.

120
00:08:09,720 --> 00:08:13,470
And now as you can see our application is running on the simulator.

121
00:08:13,490 --> 00:08:17,280
And if I click on this menu a button and click on the settings here.

122
00:08:17,390 --> 00:08:21,670
Now if I click on this specify the size of your fonts here for text you want.

123
00:08:21,860 --> 00:08:24,840
Now you can see that we don't see these deep here.

124
00:08:24,860 --> 00:08:25,440
OK.

125
00:08:25,730 --> 00:08:27,420
We just see these values.

126
00:08:27,680 --> 00:08:30,630
So you can actually customize your values here.

127
00:08:30,740 --> 00:08:35,880
But it is very important that you actually put these values inside your strings that exemplified.

128
00:08:36,320 --> 00:08:42,140
So let's go back to our preferences underline of a file for example and here as you can see I have these

129
00:08:42,140 --> 00:08:47,390
entries and entry values and I have this default value so the default value is going to be numbered

130
00:08:47,420 --> 00:08:47,940
10.

131
00:08:48,100 --> 00:08:48,840
OK.

132
00:08:49,430 --> 00:08:55,970
If the user doesn't actually want to choose any For example enforced the default value is going to be

133
00:08:56,000 --> 00:08:56,450
10.

134
00:08:56,600 --> 00:08:58,610
Right.

135
00:08:58,820 --> 00:09:04,980
Now let's actually for example choose one of these phones here for example number 70.

136
00:09:05,240 --> 00:09:07,240
And if you click on dispatch button here.

137
00:09:07,250 --> 00:09:10,540
Now I cannot see the effects here.

138
00:09:10,580 --> 00:09:17,780
I choose to actually the sex that takes place to be 70 but I cannot see that effect here and the size

139
00:09:17,840 --> 00:09:20,300
of this text actually doesn't change.

140
00:09:20,300 --> 00:09:27,190
So if I click on the menu about in here and settings in here and choose this form here to Fauntleroy

141
00:09:27,350 --> 00:09:30,590
out here and click on this patch button here.

142
00:09:30,680 --> 00:09:33,050
Now you can I can't see the effects here.

143
00:09:33,200 --> 00:09:36,860
So now we need to actually go back to our main activity that of a file here.

144
00:09:37,070 --> 00:09:41,840
And we need to actually put some lines of code here in order to see the effects.

145
00:09:41,840 --> 00:09:47,600
So now inside our main activity class we can actually paste in some lines of code here and then I'm

146
00:09:47,600 --> 00:09:50,690
going to explain to you what's going on here.

147
00:09:50,720 --> 00:09:55,580
So as you can see here these are the lines of code that I actually paste it here.

148
00:09:55,610 --> 00:10:01,240
First of all as you can see in line 21 I actually declared this object which is of type typeface.

149
00:10:01,520 --> 00:10:05,710
And here this object is actually going to hold this object here.

150
00:10:05,750 --> 00:10:08,370
As you can see here is going to hold the phone number one.

151
00:10:08,450 --> 00:10:09,040
OK.

152
00:10:09,230 --> 00:10:13,380
And B here we have this and other object which is again of type typeface font.

153
00:10:13,430 --> 00:10:14,440
Number two.

154
00:10:14,660 --> 00:10:19,320
And here I declared another object again of type type face as you can see here.

155
00:10:19,520 --> 00:10:24,170
And the name of this object is to number three in order to hold the phone number of feet.

156
00:10:24,260 --> 00:10:27,330
OK so remember that we have free phones in our project.

157
00:10:27,470 --> 00:10:33,120
So I needed to actually declare these objects of type type typeface.

158
00:10:33,140 --> 00:10:33,870
OK.

159
00:10:34,130 --> 00:10:36,750
And here I have these string values.

160
00:10:36,980 --> 00:10:39,940
The first one is takes you want size.

161
00:10:39,960 --> 00:10:46,070
This bitch is going to actually hold the size of the takes you want the second one is takes you to size.

162
00:10:46,070 --> 00:10:48,660
And the first one is takes a few precise.

163
00:10:49,130 --> 00:10:56,290
And here in line 31 I actually declare an of type shared preferences as you can see here and the name

164
00:10:56,290 --> 00:10:58,880
of the subject is shared preferences.

165
00:10:58,880 --> 00:11:04,660
So I declare this object here in order to actually save.

166
00:11:04,990 --> 00:11:10,180
They use their preferences so that when they use it for example changes are different of it takes a

167
00:11:10,180 --> 00:11:16,440
view or for example changes the size of a text view or you want to save that actually data.

168
00:11:16,570 --> 00:11:17,190
OK.

169
00:11:17,350 --> 00:11:22,510
And the use of for example close the application and then open it later that that data is going to be

170
00:11:22,510 --> 00:11:24,650
retrieved from the memory and then you can.

171
00:11:24,670 --> 00:11:27,170
And then they can actually see the results.

172
00:11:27,190 --> 00:11:27,650
OK.

173
00:11:27,740 --> 00:11:32,470
So I actually declare this object in order in order to actually hold the data.

174
00:11:32,620 --> 00:11:33,080
OK.

