1
00:00:00,410 --> 00:00:05,490
Hire everyone in this story we're going to create a model for our project.

2
00:00:05,490 --> 00:00:07,570
So he has just opened the android's view.

3
00:00:07,680 --> 00:00:13,560
And then here inside this job you can see this package right click on it and let's create a new package

4
00:00:13,560 --> 00:00:14,330
here.

5
00:00:14,640 --> 00:00:18,640
So the name of the package is going to be model and then click on OK.

6
00:00:18,690 --> 00:00:20,670
So now we have this package named mod..

7
00:00:20,670 --> 00:00:28,180
Right click on it and let's create a class jobber class and the name of the class is going to be a country

8
00:00:28,810 --> 00:00:31,750
data source data source.

9
00:00:31,780 --> 00:00:35,050
So this is the name of the model class.

10
00:00:35,060 --> 00:00:37,680
So that kind is class and here don't change anything.

11
00:00:37,680 --> 00:00:39,270
Just kidding kind of OK.

12
00:00:39,560 --> 00:00:44,210
So you can see that our model is created let's double click on this top here in order to make this area

13
00:00:44,210 --> 00:00:45,410
wider.

14
00:00:45,410 --> 00:00:48,900
So let's create a constant here instead these classes.

15
00:00:48,920 --> 00:00:53,950
They've been here public static final screens.

16
00:00:54,440 --> 00:01:01,180
And the name of this constant is going to be country underline key right.

17
00:01:01,350 --> 00:01:07,850
Assignment operator and let's assign the spider you to this constant country semicolon.

18
00:01:08,130 --> 00:01:09,790
Let's create another constant.

19
00:01:09,810 --> 00:01:18,210
So public static final and this time that data type of this constant is going to be float and the name

20
00:01:18,210 --> 00:01:23,490
of this constant is going to be minimum minimum underline

21
00:01:25,900 --> 00:01:29,980
confidence underline level

22
00:01:32,820 --> 00:01:39,790
assignment operator and let's assign this value zero point free or 0.4.

23
00:01:39,810 --> 00:01:43,030
I think 0.4 is good for minimum confidence level.

24
00:01:43,170 --> 00:01:49,580
So here because it is actually of type float we must put the letter F here at the end of our value here.

25
00:01:49,590 --> 00:01:56,160
Otherwise the compiler may think that we are actually creating a double value so it doesn't matter whether

26
00:01:56,240 --> 00:02:00,180
it is that it is actually capitalized or it is not capitalized.

27
00:02:00,180 --> 00:02:05,510
You just need to put a letter year after your value here and then again.

28
00:02:05,550 --> 00:02:17,770
Let's create another constant public static final strange on the name of this constant is going to be

29
00:02:18,010 --> 00:02:26,800
default default on the line country underline name assignment operator.

30
00:02:27,190 --> 00:02:34,130
So here let's assign this value Canada Canada semi-colon.

31
00:02:34,240 --> 00:02:37,930
So the default country name is going to be Canada.

32
00:02:37,940 --> 00:02:50,060
Let's create another constant go public static final and this time the data type is double and the name

33
00:02:50,060 --> 00:02:57,420
of this constant is default on the line country underlined latitudes

34
00:02:59,990 --> 00:03:01,940
assignment operator.

35
00:03:01,980 --> 00:03:07,770
So here we need to assign the latitude of the country named Canada to this constant.

36
00:03:07,770 --> 00:03:10,140
So let me show you the Google maps here.

37
00:03:10,260 --> 00:03:16,710
So you just need to tell this you all here in your web browser search bar here and now you can actually

38
00:03:16,710 --> 00:03:21,950
search for Canada and just click on it so it can actually show you the Canada here.

39
00:03:22,050 --> 00:03:22,740
Right.

40
00:03:22,740 --> 00:03:27,090
So if I click on this channel the name here you can see this country here.

41
00:03:27,150 --> 00:03:32,480
But let's right click on it and now let's click on what's here.

42
00:03:32,490 --> 00:03:36,240
So here you can see the latitude and longitude here right.

43
00:03:36,240 --> 00:03:37,310
So let's click on it.

44
00:03:38,470 --> 00:03:43,530
So now it's going actually show us it's going to give us the latitude and longitude So let's copy this

45
00:03:43,530 --> 00:03:45,390
right here in this search spot.

46
00:03:45,670 --> 00:03:47,840
Let's go back to Andrew in studio.

47
00:03:48,010 --> 00:03:53,430
Now let me actually create a comment here and let's paste this rally here.

48
00:03:53,470 --> 00:03:59,550
So for that latitude let's just copy this value and assign it here to this constant semi-colon.

49
00:04:00,400 --> 00:04:08,010
So let's create another constant for the longitude so public static final.

50
00:04:08,270 --> 00:04:14,360
And now let's actually specify the data type which is double and the name of this constant is going

51
00:04:14,360 --> 00:04:25,820
to be default underline country underline longitude assignment operator and let's copy disvalue here.

52
00:04:25,830 --> 00:04:31,510
This longitude copied and assign it to this constant semicolon.

53
00:04:31,520 --> 00:04:35,300
So now let's create the final constant here.

54
00:04:35,540 --> 00:04:44,690
So just type in here public static final strange and the name of this constant is going to be default

55
00:04:45,680 --> 00:04:50,500
default underline message assignment operator two coats.

56
00:04:50,570 --> 00:04:55,140
And here's a safe in here a welcome exclamation point semicolon.

57
00:04:55,190 --> 00:04:55,980
So that's it.

58
00:04:56,000 --> 00:05:00,400
These are the constants that we need inside this class country datasource.

59
00:05:00,590 --> 00:05:03,360
So let's put some other quotes here.

60
00:05:04,190 --> 00:05:08,370
So now let's create an instance variable here inside this class.

61
00:05:08,480 --> 00:05:14,530
So this step in here private and the data type of this variable is going to be hash table.

62
00:05:14,540 --> 00:05:19,600
So what is hash table hash table is actually consists of cheese and values.

63
00:05:19,670 --> 00:05:20,270
Right.

64
00:05:20,330 --> 00:05:26,270
So each item inside our hash table is going to have a key and the value for that key.

65
00:05:26,360 --> 00:05:30,550
So when we referred to that it's going to give us the value of that specific key.

66
00:05:30,710 --> 00:05:31,970
So let me show you that here.

67
00:05:32,060 --> 00:05:37,430
It's actually a lot like dictionaries in other programming languages if you are actually familiar with

68
00:05:37,430 --> 00:05:37,800
them.

69
00:05:37,970 --> 00:05:43,070
But I'm going to actually explain to you how it is implemented and how it is how you can actually define

70
00:05:43,570 --> 00:05:45,280
fashionables in Android.

71
00:05:45,560 --> 00:05:51,290
So first you need to put the angle brackets here and I told you first we need to specify the data type

72
00:05:51,560 --> 00:05:54,720
of the key which is going to be strange comma.

73
00:05:55,010 --> 00:05:58,400
And then we need to specify the data type of the value of that key.

74
00:05:58,460 --> 00:05:59,680
Again it is going to be of type.

75
00:05:59,690 --> 00:06:00,570
Strange.

76
00:06:00,770 --> 00:06:01,580
Right.

77
00:06:01,580 --> 00:06:03,780
So here I can say countries too.

78
00:06:03,790 --> 00:06:06,990
Now I need to specify the name of this hash table idea.

79
00:06:07,160 --> 00:06:16,350
So the name is going to be countries and what countries and messages Soviet we are going to have a specific

80
00:06:16,350 --> 00:06:17,000
country.

81
00:06:17,160 --> 00:06:21,450
And the message that is dedicated specifically to that country.

82
00:06:21,540 --> 00:06:27,510
So I'm going to actually show you how it how it works and then you explain and then you will understand

83
00:06:27,510 --> 00:06:29,320
it more actually better.

84
00:06:29,430 --> 00:06:32,790
But don't forget if you don't understand it now.

85
00:06:32,910 --> 00:06:36,630
For now just write the codes here and then it will make sense.

86
00:06:36,630 --> 00:06:42,200
So now it's time to create a constructor for this class country datasource.

87
00:06:42,300 --> 00:06:44,160
So just open here public.

88
00:06:44,460 --> 00:06:49,140
So this is the access modifier of this constructed and the name of the constructor must be the same

89
00:06:49,140 --> 00:06:50,240
as the name of the class.

90
00:06:50,370 --> 00:06:54,290
So it is going to be country data so it's just put a pair of Prentice's here.

91
00:06:54,300 --> 00:07:00,030
So I'm going to specify that there is going to be a parameter here for this constructor which is going

92
00:07:00,030 --> 00:07:01,750
to be off that hash table.

93
00:07:02,640 --> 00:07:04,250
Just put two angle brackets here.

94
00:07:04,260 --> 00:07:10,450
First I need to specify the data type of the key comma and then the data type of the value.

95
00:07:10,740 --> 00:07:16,830
And here to specify the name of this prime feature which is going to be countries and messages.

96
00:07:16,830 --> 00:07:22,620
So just open and close this constructed by using these curly braces and inside the body of the constructor

97
00:07:23,020 --> 00:07:27,610
I channel referred to these countries and messages instance variable by just typing here.

98
00:07:27,630 --> 00:07:31,500
These talks countries and messages assignment operator.

99
00:07:31,530 --> 00:07:36,540
And then I can refer to these argument countries and messages and I can assign these argument to this

100
00:07:36,540 --> 00:07:40,470
instance variable so I can refer to these arguments name here.

101
00:07:40,470 --> 00:07:41,460
Right.

102
00:07:41,640 --> 00:07:42,350
That's it.

103
00:07:42,600 --> 00:07:48,870
So after this constructor let's create a method here inside this country data source class.

