Hire everyone in this story we're going to create a model for our project.
So he has just opened the android's view.
And then here inside this job you can see this package right click on it and let's create a new package
here.
So the name of the package is going to be model and then click on OK.
So now we have this package named mod..
Right click on it and let's create a class jobber class and the name of the class is going to be a country
data source data source.
So this is the name of the model class.
So that kind is class and here don't change anything.
Just kidding kind of OK.
So you can see that our model is created let's double click on this top here in order to make this area
wider.
So let's create a constant here instead these classes.
They've been here public static final screens.
And the name of this constant is going to be country underline key right.
Assignment operator and let's assign the spider you to this constant country semicolon.
Let's create another constant.
So public static final and this time that data type of this constant is going to be float and the name
of this constant is going to be minimum minimum underline
confidence underline level
assignment operator and let's assign this value zero point free or 0.4.
I think 0.4 is good for minimum confidence level.
So here because it is actually of type float we must put the letter F here at the end of our value here.
Otherwise the compiler may think that we are actually creating a double value so it doesn't matter whether
it is that it is actually capitalized or it is not capitalized.
You just need to put a letter year after your value here and then again.
Let's create another constant public static final strange on the name of this constant is going to be
default default on the line country underline name assignment operator.
So here let's assign this value Canada Canada semi-colon.
So the default country name is going to be Canada.
Let's create another constant go public static final and this time the data type is double and the name
of this constant is default on the line country underlined latitudes
assignment operator.
So here we need to assign the latitude of the country named Canada to this constant.
So let me show you the Google maps here.
So you just need to tell this you all here in your web browser search bar here and now you can actually
search for Canada and just click on it so it can actually show you the Canada here.
Right.
So if I click on this channel the name here you can see this country here.
But let's right click on it and now let's click on what's here.
So here you can see the latitude and longitude here right.
So let's click on it.
So now it's going actually show us it's going to give us the latitude and longitude So let's copy this
right here in this search spot.
Let's go back to Andrew in studio.
Now let me actually create a comment here and let's paste this rally here.
So for that latitude let's just copy this value and assign it here to this constant semi-colon.
So let's create another constant for the longitude so public static final.
And now let's actually specify the data type which is double and the name of this constant is going
to be default underline country underline longitude assignment operator and let's copy disvalue here.
This longitude copied and assign it to this constant semicolon.
So now let's create the final constant here.
So just type in here public static final strange and the name of this constant is going to be default
default underline message assignment operator two coats.
And here's a safe in here a welcome exclamation point semicolon.
So that's it.
These are the constants that we need inside this class country datasource.
So let's put some other quotes here.
So now let's create an instance variable here inside this class.
So this step in here private and the data type of this variable is going to be hash table.
So what is hash table hash table is actually consists of cheese and values.
Right.
So each item inside our hash table is going to have a key and the value for that key.
So when we referred to that it's going to give us the value of that specific key.
So let me show you that here.
It's actually a lot like dictionaries in other programming languages if you are actually familiar with
them.
But I'm going to actually explain to you how it is implemented and how it is how you can actually define
fashionables in Android.
So first you need to put the angle brackets here and I told you first we need to specify the data type
of the key which is going to be strange comma.
And then we need to specify the data type of the value of that key.
Again it is going to be of type.
Strange.
Right.
So here I can say countries too.
Now I need to specify the name of this hash table idea.
So the name is going to be countries and what countries and messages Soviet we are going to have a specific
country.
And the message that is dedicated specifically to that country.
So I'm going to actually show you how it how it works and then you explain and then you will understand
it more actually better.
But don't forget if you don't understand it now.
For now just write the codes here and then it will make sense.
So now it's time to create a constructor for this class country datasource.
So just open here public.
So this is the access modifier of this constructed and the name of the constructor must be the same
as the name of the class.
So it is going to be country data so it's just put a pair of Prentice's here.
So I'm going to specify that there is going to be a parameter here for this constructor which is going
to be off that hash table.
Just put two angle brackets here.
First I need to specify the data type of the key comma and then the data type of the value.
And here to specify the name of this prime feature which is going to be countries and messages.
So just open and close this constructed by using these curly braces and inside the body of the constructor
I channel referred to these countries and messages instance variable by just typing here.
These talks countries and messages assignment operator.
And then I can refer to these argument countries and messages and I can assign these argument to this
instance variable so I can refer to these arguments name here.
Right.
That's it.
So after this constructor let's create a method here inside this country data source class.