So now as you can see here we have an actually of Ordnung here and it says many items should specify
a title and this means that if our application is not actually able to load this vector image it is
going to actually load this title for our menu option for our menu button.
So let's actually specify at hightails So here I can just type in title and then I can choose this attribute.
And here I can just say that the title is going to be settings or who is sitting.
OK so now as you can see here the warning is gone.
And now let's actually create our preferences file.
Inside our project.
So now just a selectees rest folder here.
Right click on it new and then just selectees and roit resource directory and read the source file.
Excuse me just excuse me.
Let's actually move through this process again.
Right click on these arrests for the new and then choose Android resource wide.
OK.
And for the name just type in here cuius underline preferences.
OK.
Is underlined preferences.
And now for to actually for the resource type choose ASML as you can see here.
And as you can see here the root element is preference.
Screen the source said is main and the directory name is exit right.
And actually.
OK.
As you can see here now we have a new directory called ASML and we have this quiz underline preferences
that example.
So this image here is actually it like an activity.
And now let me show you what this does here.
So now let me open the emulator here.
Disqus application.
And now if we click on this a setting button here as you can see now this activity is open.
Right here you can see these options and this activity is this one right this is the preferences.
We can actually use these options in order to specify and in order to specify the actually the settings
of our application.
For example the types of animal that you want to be used inside Yamla inside the keys for example the
number of cases that you choose by given color for example I can specify the background color for example
black.
And then I can specify the quarries the front of our Barkleys application as you can see here the text
of our buttons as you can see here are all going to be if their phones are going to be changed according
to these phones.
Now if I actually click on dispatch button here as you can see here the background color is black.
Right.
So hopefully that makes sense.
And now let's actually go inside this quiz.
Go inside these quis briefness is that exemplified.
And then click on a text here at the bottom as you can see we have this design tab and we have this
text tab here at the bottom right.
So just select it takes tab and now let's actually double click on the squeeze on the line preferences
that XML file as you can see here just double click on these tab in order to make this area wider and
inside his preference screen as you can see we can put our own logic here for the settings activity.
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
on here.
So as you can see here these are the lines of code that I pasted here.
Right.
If you have a list preference and as you can see here the entries are number of guesses list and the
entry values are again a number of cases least we had which we haven't provided the values yet and that
he is setting's underline number of guesses.
And as you can see here the title is number of guesses title.
So we have our strange resource.
So let's actually open our emulator in order to show you this here.
So just click on this.
If I actually click on the settings here as you can see now I am actually creating this list here I
am creating this option here number of guesses as you can see the title is number of guesses and we
have this description.
Show two four or six guess options.
As you can see here this is the description and if I click on it as you can see we have these entries
so the entries as you can see here are the values that we are going to show to the user.
OK those entries are actually only useful for showing them to the user.
So for example we have 2 4 6.
So we're going to show those values to 4 6 through the user and we have also entry values which is very
important.
This is going to be these values are going to be the actual values.
So again because we are just specifying the number of desires we can use the entries or into the values
into these values the same.
So 2 4 6 and the key is actually setting underline number of cases.
So it is very important that we specify a key for our least preference here because of it when we are
actually coding our application inside our main activity that Java or other dhaba files we must actually
use this key in order to reverse this list preference.
So this is really important that you actually provide Actually this is like an ID.
OK.
And if you have a title.
So I already talked about this title so if I clicked on this cancel here.
Now you can see this is the total number of guesses and show two four or six just options.
This is actually the description.
So as you can see this is the sum of the attributes and we have this persistent attribute So what is
this persistent attribute this persistent attribute is going to determine for example if I actually
said it.
Number four here number of cases is 4.
As you can see this if you click on dispatch button here now as you can see the number of cases are
four right.
And this persistent attribute is going to help to save these settings to the shared preferences.
So for example if they actually delete.
For example if I close this application and now if I want to for example open this application here
again as you can see here but this is that application right.
And now as you can see the settings are actually saved.
And that's the job of this persistent attribute this persistent attribute is going to actually save
those settings to the shared preferences so that whenever an application is actually run or running
for the for the next time you can actually read those values to settings from the shared preferences.
So this is very important that you specify a persistent attribute for your Actually for your list programs
or other components inside this preference screen.
OK.
Because it's going to actually save these settings to the shared preferences.
So true persistent true.
And we have our default values so if we don't actually provide our value for our For example number
of cases the default value is going to be number four right.
So the default value is four.
And now we need to actually provide some values for the entries and the values title and summary inside
there for example at a resources or for example is resources.
So now let's actually open our project structure.
So now just click on View tool windows and then click on project and then here inside these values folder.
Just double click on these strings that they send here as you can see.
And now let's actually pro-white some string resources here that actually provide some string values
here and here.
Let's actually go inside the squeeze underline preferences that is him here.
Again as you can see here.
The first one is the total number of guesses total right.
So let's actually copy this value a number of guesses title.
And now let's actually go again inside the streams that exemplified and actually create a string the
here.
And the name is going to be number of cases title.
And now let's actually close this tag and here for this string resource I can actually provide the value
here.
Let's actually open our emulator as you can see here.
The title is number of guesses right.
So here again to say PIN number number of guesses number of guesses.
Right.
So now let's actually go again inside this quiz quiz underlying preferences are the example.
And here we have another string value number of guesses description.
So let's copy this value here and now let's actually go inside the string that is modified.
And here let's actually create another string rissoles.
So strange.
And for the name just paste that value here a number of cases description and then close the stack here.
So now I actually double click on the tab here in order to make his area wider.
So far the value is actually open or emulator again here.
So the value so for the description as you can see here is just typing show two four or six just options.
So here I can just type in schul to 4 or six gifts options right.
This is going to be the description the Samadi as you can see here and now let's actually go again inside
the squeeze underline preferences that is the.
As you can see here.
Now the arrow is gone and we also need to provide some values here.
As you can see at sign at a slash number of guesses at least.
And as you can see here Vidi to actually provide another example right here.
So let's open our project structure.
So just click on this view tool windows project.