So in our project structure just click on this package here inside this Java folder.
Click on this package right click on it new and for the name just type in here for the new and select
this job class and for the name of your Java class just they've been here.
France's activity
and then click on OK.
So here as you can see I have this class here and this class here these preferences activity needs to
extend needs to actually extend from the France activity.
In our Android preferences as you can see here Android that preference that preferences that preference
activity this is really important because we want to actually create a preference activity in order
to let the user to actually change some settings we need to extend from the previous activity that we
have inside this android that preference package.
OK so now I can actually put my own logic here in this class.
So the first thing that we need to do here is to actually overwrite the uncreate method.
OK.
So as you can see here we have this uncreate method.
I just need to select it and then press Enter key on my keyboard.
So here as you can see I am actually overwriting the uncreate method that we actually extend.
We inherit that dismembers from this preference activity class.
So inside this class Enceladus and create Smurfit I can just take an ad free France from resource.
OK it is Lafferty's deprecated but you need to act as a developer.
You need to know about these Misfit's because in the future you mean human actually can encounter some
projects that actually use this method in order to get these up.
For example many will find those that preference file that prevents a xml file from the resources.
So here I can just type in our DOT exit mail dot preferences underline find as you can see here and
here and just adding preferences here for this activity add preferences from resource are examples that
preferences underline file.
This is actually like the set content view Meffert that we actually like to put in our main activity
class inside this uncreate if and as you can see in order to put this out file on our activity.
Ok for example are that leave out an activity but for our preferences activity we need to use this Minford
I add preferences from resource are that example that preferences file.
OK.
So in our main activity that java file here when the user clicks on these settings a button here as
you can see on our emulator Let me show our emulator to you now.
So here is our emulator and if I click on the menu button here you can see it is sitting here.
So then I click on the settings here I want to actually move to the preferences activity and I want
to actually open this a preference underline find that example in order to let the user see these checkbox
preferences and this category and this list views.
OK in this lawsuit that I created here this list preference.
OK.
So let's go back to our main activity that our file and inside this case statement.
So when the user clicks on the sitting spot.
And what do I want to happen.
So here I just need to create an intent object so intent and the name of my object is intent.
Assignment operator so here I want to instantiate this object new intent at inside Apprentice's.
First I need to specify the first class main activity but this and I want to move to these preferences
activity class right.
So here I can just type in preferences activity class and then put a semicolon at the end of your statement.
And here I can't just type in start activity intent.
OK so now let's actually run our project and see what happens.
So if we don't run our project now our application is going to actually crash when I want to actually
move to the preferences activity and I want to show you why this happens.
So as you can see here our application is running on dissimulated.
And if we click on this menu here.
Now you want to click on the settings here and as you can see here now our application has actually
crashed.
Why.
Because in the Android manifest here as you can see in our project structure inside this manifest folder
I have this android manifest that exemplified.
So here inside our manifest we didn't actually put up this activity and activity tag for our preferences
activity.
So inside our application tag I need to actually open another task with the name activity and the name
of this activity is going to be preferences activity.
So remember this preferences activity is inside this default package here.
OK.
That example that is a site that that app number 51 so it doesn't select need to select this one here
and that I need to close this attack here.
OK.
So let's run our project again and see what happens.
So here as you can see our application is running on this emulator.
And if I click on this menu in here and here I want to click on the settings here.
Now I successfully move this activity here and now as you can see here it just takes a number of settings.
So this I truly open our preferences underline for example here.
Now you want to show you these values.
So here I have this title takes number one sitting right and he had as you can see at the top it says
text number one settings.
This is the total of the preference category.
Right.
And here I have these checkboxes as you can see chunk five.
This is the title as you can see here.
And now as you can see here I have this subtitle here.
This is number one.
So this is the summary.
As you can see here this is the description.
And we also have this default value which is going to specify the font.
And we have this checkbox here that we can get you to check or uncheck.
Right.
And we also have other text boxes Fauntleroy Brown and this checkbox wunderbar spaced them all right.
And here as you can see we have this one specify the size of your forms for ticks view 1.
So here this is our least preference as you can see here.
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.
Choose one of these sizes.
So here as you can see the title is as you can see it.
Click on cancel here.
The title is this value.
Specify the size of your faults for text view of one as you can see here.
This is the title and the date title is.
If I click on it the dialog title is choose one of these sizes so that I like.
And we have these entries and entry values as you can see here 25 the Piep 40 DP 45 dpi and these values.
So inside are strings that exemplified here as you can see these are the values that are going to be
shown to the user.
And these are the actual values.
OK.
For 25 40 45 or other values that you may want to add or for example delete.
OK.
So in our project as you can see here in our application we have these values.
It is very important that you actually put these string values here.
OK.
This of font sizes and font sizes values OK.
And it's going to try to show these values to the user.
So now for example I don't want to actually show these deep keys to the user.
OK.
I don't want to I don't like this deep here.
So here I just need to delete this DP here.
OK.
These are the values that are going to be shown to the user.
OK.
So for example here Depay and delete this one this font and this one.
And finally this one.
So let's run our project again and see what happens.
And now as you can see our application is running on the simulator.
And if I click on this menu a button and click on the settings here.
Now if I click on this specify the size of your fonts here for text you want.
Now you can see that we don't see these deep here.
OK.
We just see these values.
So you can actually customize your values here.
But it is very important that you actually put these values inside your strings that exemplified.
So let's go back to our preferences underline of a file for example and here as you can see I have these
entries and entry values and I have this default value so the default value is going to be numbered
10.
OK.
If the user doesn't actually want to choose any For example enforced the default value is going to be
10.
Right.
Now let's actually for example choose one of these phones here for example number 70.
And if you click on dispatch button here.
Now I cannot see the effects here.
I choose to actually the sex that takes place to be 70 but I cannot see that effect here and the size
of this text actually doesn't change.
So if I click on the menu about in here and settings in here and choose this form here to Fauntleroy
out here and click on this patch button here.
Now you can I can't see the effects here.
So now we need to actually go back to our main activity that of a file here.
And we need to actually put some lines of code here in order to see the effects.
So now inside our main activity class we can actually paste in some lines of code here and then I'm
going to explain to you what's going on here.
So as you can see here these are the lines of code that I actually paste it here.
First of all as you can see in line 21 I actually declared this object which is of type typeface.
And here this object is actually going to hold this object here.
As you can see here is going to hold the phone number one.
OK.
And B here we have this and other object which is again of type typeface font.
Number two.
And here I declared another object again of type type face as you can see here.
And the name of this object is to number three in order to hold the phone number of feet.
OK so remember that we have free phones in our project.
So I needed to actually declare these objects of type type typeface.
OK.
And here I have these string values.
The first one is takes you want size.
This bitch is going to actually hold the size of the takes you want the second one is takes you to size.
And the first one is takes a few precise.
And here in line 31 I actually declare an of type shared preferences as you can see here and the name
of the subject is shared preferences.
So I declare this object here in order to actually save.
They use their preferences so that when they use it for example changes are different of it takes a
view or for example changes the size of a text view or you want to save that actually data.
OK.
And the use of for example close the application and then open it later that that data is going to be
retrieved from the memory and then you can.
And then they can actually see the results.
OK.
So I actually declare this object in order in order to actually hold the data.
OK.