1
00:00:00,120 --> 00:00:00,890
Play everyone.

2
00:00:00,990 --> 00:00:05,890
So now it's time to create a class called database hndler.

3
00:00:05,970 --> 00:00:07,870
So let's open the Android view here.

4
00:00:07,920 --> 00:00:10,800
Let's open this app folder Dhaval.

5
00:00:10,980 --> 00:00:13,080
And he had opened this package.

6
00:00:13,200 --> 00:00:14,570
Just click on model.

7
00:00:14,580 --> 00:00:19,800
He opened this model here just click on model but I click on it and the new and then click on class

8
00:00:20,340 --> 00:00:26,570
the name of the class is going to be database database handler.

9
00:00:26,670 --> 00:00:27,300
Right.

10
00:00:27,300 --> 00:00:30,590
So the client is class don't change anything and just click on it.

11
00:00:30,600 --> 00:00:31,140
OK.

12
00:00:33,110 --> 00:00:38,240
So now that our database handler class is created let's double click on this tab here in order to make

13
00:00:38,240 --> 00:00:46,640
this area wider so this class database handler must inherit from that is still left open handed open

14
00:00:46,640 --> 00:00:47,790
helper class.

15
00:00:48,050 --> 00:00:57,180
So let's just open extents it's a light open helper is you light open.

16
00:00:57,350 --> 00:01:01,520
So now that we are actually inheriting from this class is kulak of an helper.

17
00:01:01,700 --> 00:01:05,470
We need to put our own logic here.

18
00:01:05,840 --> 00:01:08,810
So let's create some variables inside this class.

19
00:01:08,810 --> 00:01:16,490
The first value is going to be private static final strange and the name of this variable is going to

20
00:01:16,490 --> 00:01:18,880
be it is going to be capitalized.

21
00:01:18,890 --> 00:01:26,760
So just like in his database database underly name assignment operator.

22
00:01:26,840 --> 00:01:32,170
So just put two quotes here and the name of the database is going to be martial arts.

23
00:01:32,330 --> 00:01:38,430
So let's make it lubricates the martial arts database.

24
00:01:38,570 --> 00:01:39,410
Right.

25
00:01:39,410 --> 00:01:44,120
So let me make this the actually the capitalized martial arts database.

26
00:01:44,120 --> 00:01:45,790
So this is the name of our database.

27
00:01:45,800 --> 00:01:46,290
Right.

28
00:01:46,550 --> 00:01:49,020
Let's create another variable.

29
00:01:49,280 --> 00:01:59,570
So this variable is going to specify the version of the database so private static final int the name

30
00:01:59,570 --> 00:02:03,330
of this variable is going to be database versions which are safe in here.

31
00:02:03,400 --> 00:02:09,370
Database under light version assignment operator.

32
00:02:09,600 --> 00:02:15,360
So you are going to assign the value number one to this valuable because this is the first actually

33
00:02:15,360 --> 00:02:16,460
the version of our database.

34
00:02:16,470 --> 00:02:19,450
So it makes sense to assign number one to this variable.

35
00:02:19,860 --> 00:02:22,440
So now it's time to create another Raddy event.

36
00:02:22,950 --> 00:02:25,940
Actually these are not ready at Bellis these are constants.

37
00:02:25,950 --> 00:02:26,360
Right.

38
00:02:26,460 --> 00:02:32,630
So remember a constant is actually a variable that its value cannot be changed later in the code.

39
00:02:32,850 --> 00:02:35,470
So let's create another constant private's.

40
00:02:35,640 --> 00:02:44,480
So let me actually change it to private static final Stream.

41
00:02:45,510 --> 00:02:50,640
And the name of this variable is going to be capitalized and it is going to be martial arts martial

42
00:02:50,640 --> 00:02:59,910
arts underline table right assignment operator and I'm going to put two coats here so I'm going to ask

43
00:03:00,030 --> 00:03:01,690
about your martial arts.

44
00:03:02,110 --> 00:03:09,750
So let's make it actually the first leader of the martial arts should be should be capitalized martial

45
00:03:09,750 --> 00:03:10,250
arts.

46
00:03:10,500 --> 00:03:11,730
So this is the name of our table.

47
00:03:11,740 --> 00:03:14,640
OK it's better to name it in this way martial arts.

48
00:03:14,640 --> 00:03:17,010
So the name of this constant is actually capitalized.

49
00:03:17,010 --> 00:03:17,400
Right.

50
00:03:17,460 --> 00:03:18,870
Martial arts.

51
00:03:19,230 --> 00:03:22,520
So let's create another constant.

52
00:03:22,610 --> 00:03:30,890
So I'm going to type in private stage static final strange and the name of this constant is going to

53
00:03:30,890 --> 00:03:39,440
be actually the underline key assignment operator just put two chords here assign the value ID to this

54
00:03:39,440 --> 00:03:40,260
value.

55
00:03:40,850 --> 00:03:49,220
Let's create another variable private static final strange the name of this valid constant here is going

56
00:03:49,220 --> 00:03:55,410
to be actually the name key so name underlined key assignment operator.

57
00:03:55,640 --> 00:03:57,320
Just put two codes here.

58
00:03:57,320 --> 00:04:07,730
So assigning the value name to this constant semicolon private static final strange price key price

59
00:04:08,180 --> 00:04:13,210
underline key assignment operator just put two codes here and just type in here.

60
00:04:13,220 --> 00:04:25,640
Price semicolon private static final screen and for it is going to be actually the color key so color

61
00:04:26,120 --> 00:04:28,120
underline key assignment operator.

62
00:04:28,130 --> 00:04:30,530
Put two coats here and just type in here.

63
00:04:30,530 --> 00:04:33,400
Color semicolon.

64
00:04:33,400 --> 00:04:39,710
So these are the constants that you actually created here inside our database handler class.

65
00:04:39,710 --> 00:04:41,920
First we specified the database name.

66
00:04:42,290 --> 00:04:45,740
And then we are specifying the database version martial arts table.

67
00:04:45,740 --> 00:04:48,020
So this is the table that we want to put our data in.

68
00:04:48,020 --> 00:04:49,560
So this this is very important.

69
00:04:49,580 --> 00:04:56,000
This constant is very important and we have the ID key name key price key and the color key we are going

70
00:04:56,000 --> 00:04:58,990
to use them inside our class database handler.

71
00:04:59,270 --> 00:05:05,870
Here the first thing that we need to do here is going to is actually to create a constructor for this

72
00:05:05,870 --> 00:05:15,260
database handler class so I can say public database handler database handler and just put a pair of

73
00:05:15,260 --> 00:05:22,160
practices here inside the prentices we need to specify privater of type context right and open and close

74
00:05:22,160 --> 00:05:29,630
this constructed by using these curly braces inside this constructor I must call the constructor of

75
00:05:29,630 --> 00:05:32,760
the superclass which is this one is like open helper class.

76
00:05:32,870 --> 00:05:40,330
So I'm going to say super and we need to pass some arguments to these super constructor here.

77
00:05:40,580 --> 00:05:46,370
So let me actually just hold down the comment on my keyboard if I click on this school like open helper

78
00:05:46,370 --> 00:05:47,480
class.

79
00:05:47,480 --> 00:05:51,950
Now here let me show you the constructor of this class look at this constructor.

80
00:05:51,950 --> 00:05:58,900
First we need to pass the context and then we passed the name to the cursor factory and aversion.

81
00:05:59,180 --> 00:05:59,690
Right.

82
00:05:59,690 --> 00:06:02,410
So let's pass then let's go to the datums handler class.

83
00:06:02,480 --> 00:06:04,410
First we need to pass the context right.

84
00:06:04,430 --> 00:06:08,480
So we created a parameter of type context here for this constructor.

85
00:06:08,480 --> 00:06:10,890
So I can pass this argument here context comma.

86
00:06:11,030 --> 00:06:15,470
And as the second argument we must pass the database name.

87
00:06:15,470 --> 00:06:19,440
Let me show you the as you like open Hilbert helper class you can see that the second argument is of

88
00:06:19,440 --> 00:06:21,560
type string and it's and it is actually name.

89
00:06:21,770 --> 00:06:23,910
So this refers to the database name.

90
00:06:24,110 --> 00:06:29,370
Let's go to the death of his handler class so we created a constant for that database name here right.

91
00:06:29,590 --> 00:06:30,120
Right.

92
00:06:30,140 --> 00:06:35,890
So I can say a database name database name comma.

93
00:06:36,040 --> 00:06:40,750
So let's go to the if you like open helper class in order to see the first argument which is going to

94
00:06:40,750 --> 00:06:42,280
be our third cursor factory.

95
00:06:42,280 --> 00:06:46,820
So inside our application we do not actually use this cursor factor here.

96
00:06:46,930 --> 00:06:52,110
So let's go to the database handler class and let's pass the value non comma.

97
00:06:52,540 --> 00:06:54,660
Let's go back to school like open helper class.

98
00:06:54,670 --> 00:06:57,670
And finally we need to pass the school date version.

99
00:06:57,670 --> 00:07:02,400
So let's go to the date I was handed a class and we actually created a constant for this one here right

100
00:07:02,400 --> 00:07:03,290
database version.

101
00:07:03,400 --> 00:07:06,600
So I can just pass that your database version.

102
00:07:06,700 --> 00:07:07,960
That's it.

103
00:07:07,960 --> 00:07:13,180
So this is our constructor for this database handler class after this constructor.

104
00:07:13,330 --> 00:07:13,890
I can't say.

