So now I'm going to paste in some lines of code here inside this class.
So before the end in calibers of this class I'm going to paste in some lines of code 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 and now as you can see this is
actually a method.
So public voit as you can see the access modify it is Popbitch the return type of the Smurfette is void
and the name of this method is modify each type of inquiries.
So as you can see this bifurcation accepts an argument of type shared preferences and the name of this
argument is shared preferences.
And as you can see are actually opened and closed.
This effort by using these curly braces.
So now let's actually go inside the curly braces of this method and let's see what's going on here.
So first of all let me tell you that the purpose of this method is to actually modify the type of animals
that you want to have inside our quiz.
So now let me show you the emulator as you can see it this is our emulator.
And for example now we can actually play with Disqus here.
But now let's let's actually go inside the settings activity.
And now here as you can see we have this item animals right.
So just click on it and here.
Let's actually assume that I want to only have wild animals inside my quiz so I just need to check these
wild animals here as you can see.
And now I just need to click on OK and then actually click on back here.
As you can see here now the quiz is going to have only actually wild animals.
So for example this is actually a leopard.
And now the next image is going to be again a wild animal.
For example this is a dog right.
So now as you can see by actually changing the settings and actually changing the type of animals that
you want to have in say the quiz we can actually determine the type of animals that we can have inside
the squeeze.
So that's the purpose of this method here.
When I actually change the type of the animals here as you can see this Mfat here is going to be called.
So now as you can see let's actually go inside the curly braces of the Smurfette.
So first as you can see I actually fed to this this valuable animal types inquiries so analysis should
go inside our class.
Let's scroll to the top of the file here.
As you can see we actually created this set here as you can see this is actually a set of string values
and the name of our set is animal types in quiz.
So not essentially just add up.
Let's actually look at this line of code here.
He had actually said right.
I told you about it before that sets cannot have duplicated values right.
So now as you can see let's scroll down here and let's actually go back into our method here.
As you can see here.
So animal types inquiries assignment operator.
So here I am actually initializing this set.
Right.
So here I am referring to this share's preferences argument that I get from Smurfette does get strength
set.
So as you can see here I am calling this method get string set.
So by calling the smith and I can actually get a set of string values.
So now let's scroll to the top of the file here as you can see we actually have actually a set of string
values as you can see here a set of string values and the name is animal types in quotes.
So now let's scroll down here.
As you can see I am actually calling this method get string set.
So this Smurfette is going to give us a set of values.
So for the arguments as you can see here we need to specify the key.
So the key is main activity that animals underline type.
And now it's actually legal in say the main activity file here as you can see inside this main activity
class in line number 17.
I actually created this constant here.
Right.
And as you can see the data type is strengthen Aimee's.
Underline type assignment operator.
And inside the double quotes you can see that we put these values settings underline animal type.
So this is the key that is specified inside the squeeze on the left preferences that example as you
can see here.
So here we have actually a multi-select a multi-select list preference as you can see.
So now you can see that the entries are type of animals the interest values as you can see here type
of animals values.
So let's actually hold the Comanche on a keyboard and then click on these entries here as you can see
this is actually the entries.
So these values are the values that we are going to show to the user right.
Wild animals or tame animals.
And if I show you the emulator as you can see these are the two values.
Wild animals or tame animals.
And let's actually go back into our quiz Underland preferences that exemplified and we have also into
values.
So these three values are the actual values that we are going to work with here.
As you can see so I actually hold the comments on my keyboard and then I clicked on that and three values.
And here is here is the radius right.
You can see that a type of animals values.
And as you can see white underline any mouse or paint on the animals.
So these are the values that we are going to work with from our job coats.
So let's go back into our quiz.
Underland preferences that exemplified and here you can see that the key is settings underline and impulse
type.
So I created this key here so that I can actually interact with this multi-select this preference from
my job.
Cote's so inciters main activity here main activity of a fight.
I actually created this key here and then I assigned this key to this constant so that when ever I want
to use this key I can actually refer just to this name here.
Animals on the type Smain activity that animals underling type.
So if I go back into our Actually main activity fragment of the Java file as you can see inside this
class I actually passed this key so that I can actually get this string set here as you can see main
activity that animals type.
And for the default value I passed the value null.
Why.
Because inside the underlying preferences that exemplified I actually specified a default value for
this multi select list preference as you can see here.
Right.
Value is an assignment operator and instead of quotes at St..
Address what this refers to the arrays that exemplified slash type of animals by the use.
And if I hold that control if I hold the comment on my keyboard.
So if you are using a Windows machine just hold the control key on your keyboard and then click on this
value here.
As you can see this is actually the default value type of animals values.
So he's going to use these values here.
Right.
Wild Underland animals or tame Underland and tame underline animals.
So by default both of these types are going to be included in say the keys.
Right.
So for the first time that they use that is actually has installed this application on his or her device.
They can actually see both vile animals and tame animals inside a quiz as you can see here.
Right.
So hopefully that makes sense.
Now let's actually go back into our Actually main activity fragment that of a file.
And here you can see that we are actually getting this thing set here from this key main activity that
animals type.
And for the default value I-PASS the value null and of assigning that string set to these animal types
inquiries valuable.
Right.
So now that's enough for the Smurfette.
OK.
So let's actually I'm going to add some more lines of code here for other functions.
So as you can see if I show you the emulator and if I go to the settings activity as you can see here
we need to provide some logic for this to get on color.
So for example when the user selects the bike it uncolored B to B.
For example white.
And when they click on dispatch button here as you can see now that baculum color is white.
Right.
And they can actually just the animal here.
So let's actually go back into our Android studio and let's actually go inside this class.
Main activity fragment class.
So before the end in curly brace of this class you're going to pay some lines of code and then I'm going
to explain to you what's going on here.