1
00:00:00,350 --> 00:00:03,360
So the access modify it is public as you can see here.

2
00:00:03,630 --> 00:00:08,870
And the name of the constructor must be the same as the name of our class.

3
00:00:08,870 --> 00:00:14,070
So I just know that type been here my school like handler and inside apprentices I need to provide an

4
00:00:14,130 --> 00:00:17,610
argument of type context as you can see here.

5
00:00:17,900 --> 00:00:23,030
And the name of this argument is going to be context and that I need to open and close this constructor

6
00:00:23,040 --> 00:00:24,860
by using these curly braces.

7
00:00:25,050 --> 00:00:30,720
And here as you can see we have an error and this error is because of the constructor of the superclass.

8
00:00:30,750 --> 00:00:34,990
So we need to actually call the constructor of the superclass.

9
00:00:34,980 --> 00:00:38,960
So I just need to type in here super at inside Apprentice's.

10
00:00:39,150 --> 00:00:41,530
I need to provide some values.

11
00:00:41,580 --> 00:00:50,070
The first value that I need to provide here is actually context comma and the second argument that I

12
00:00:50,070 --> 00:00:52,550
need to provide is actually the name of the database.

13
00:00:52,560 --> 00:00:54,890
So here I just need to type in database name.

14
00:00:55,020 --> 00:01:00,720
So here I actually fell to the name of these constants that I actually created in line 17 as you can

15
00:01:00,720 --> 00:01:01,480
see here.

16
00:01:01,530 --> 00:01:05,070
I specified the name of the database so computer that.

17
00:01:05,090 --> 00:01:06,820
This is the name of my database right.

18
00:01:06,990 --> 00:01:11,580
So for the second argument I need to provide the database name karma.

19
00:01:12,110 --> 00:01:15,140
And for the first argument I assign the value null.

20
00:01:15,150 --> 00:01:18,450
So let's actually hold the command key and then click on the super here.

21
00:01:18,450 --> 00:01:21,600
So if you are using I mean those machine just hold the control key.

22
00:01:21,600 --> 00:01:23,340
And then click on the super here.

23
00:01:23,520 --> 00:01:28,800
And as you can see here we have these a constructor here and this constructed here.

24
00:01:28,830 --> 00:01:34,350
So as you can see here we are actually calling this a first constructor.

25
00:01:34,440 --> 00:01:38,400
This first constructed of the superclass is q like open helper.

26
00:01:38,400 --> 00:01:40,020
The first one is context.

27
00:01:40,080 --> 00:01:42,540
The second one the name of the database.

28
00:01:42,600 --> 00:01:46,020
OK database name and the first one is cursor factory.

29
00:01:46,020 --> 00:01:51,910
So for the cursor factory I assigned the value not because we don't need a cursor factory for this application.

30
00:01:52,070 --> 00:01:52,710
OK.

31
00:01:52,980 --> 00:01:57,470
And for the first argument we need to actually provide the database version.

32
00:01:57,660 --> 00:02:03,810
OK so here as you can see for the first argument which is actually across a factory which we don't need

33
00:02:03,810 --> 00:02:10,740
that in the application I assign the value null and I put a comma here and there for the fourth argument

34
00:02:10,770 --> 00:02:13,320
I assigned the value database version.

35
00:02:13,320 --> 00:02:16,450
So here I need to specify the version of the database.

36
00:02:16,470 --> 00:02:19,110
So as you can see here the error is gone.

37
00:02:19,110 --> 00:02:20,020
Right.

38
00:02:20,040 --> 00:02:26,010
So now I need to actually overwrite some of the methods that are actually inside of this is like open

39
00:02:26,010 --> 00:02:26,940
helper class.

40
00:02:27,060 --> 00:02:33,750
And as you can see here it says class is school that handler must be declared abstract or implement

41
00:02:33,810 --> 00:02:38,180
abstract method of great and the uncreate in a school like open helper.

42
00:02:38,370 --> 00:02:43,920
So here as you can see we've got two methods that we need to actually override here inside our school

43
00:02:43,920 --> 00:02:45,240
like handler class.

44
00:02:45,240 --> 00:02:51,240
The first one is actually uncreate and if it says this is the method that we need to provide for this

45
00:02:51,690 --> 00:02:53,290
why is q late handler class.

46
00:02:53,310 --> 00:02:56,210
So as you can see here is the name of this method is uncreate.

47
00:02:56,220 --> 00:03:01,050
And as you can see this if it actually to accept an argument which is of type A school like database

48
00:03:01,110 --> 00:03:03,400
and the name of this argument is the B.

49
00:03:03,570 --> 00:03:09,650
So here inside the Smurfit I can just refer to the name of this db here D-B argument which is of type

50
00:03:09,660 --> 00:03:16,500
as school database that executes execute as well as you can see here and here in say the practice of

51
00:03:16,500 --> 00:03:16,980
this method.

52
00:03:16,990 --> 00:03:19,970
I can just refer to the name of this string valuable.

53
00:03:19,980 --> 00:03:24,690
Create a computer table create computer table.

54
00:03:24,900 --> 00:03:29,250
OK so now it can actually create a computer table for us.

55
00:03:29,340 --> 00:03:31,920
OK for this application this is really important.

56
00:03:31,920 --> 00:03:33,590
You need to put this value here.

57
00:03:33,690 --> 00:03:34,240
OK.

58
00:03:34,260 --> 00:03:37,920
Otherwise it's not going to actually create a table for our application.

59
00:03:37,920 --> 00:03:38,480
OK.

60
00:03:38,850 --> 00:03:46,490
So now I need to overwrite the upgrade Smurfette upgrade here and this method is going to be called.

61
00:03:46,740 --> 00:03:51,930
For example when you happen when you actually upload or your application to the Google Play store and

62
00:03:52,090 --> 00:03:57,920
venue and for example two months later you want to update your application and you want to actually

63
00:03:57,930 --> 00:03:59,690
change your database.

64
00:03:59,700 --> 00:04:01,880
This limit is for that situation.

65
00:04:02,070 --> 00:04:07,910
So you need to actually drop the current database and then create a new database.

66
00:04:08,010 --> 00:04:13,080
OK so now I'm going to paste in some lines of code here and then I'm going explain to you what's going

67
00:04:13,080 --> 00:04:13,850
on here.

68
00:04:13,860 --> 00:04:20,000
So as you can see here these are the lines of code that I actually pasted here inside this on upgrade

69
00:04:20,010 --> 00:04:20,640
Befort.

70
00:04:20,850 --> 00:04:26,030
And as you can see ighly further to the name of this argument which is of type Escuela database db that

71
00:04:26,100 --> 00:04:30,600
execute as well as you can see here and inside the double quotes.

72
00:04:30,600 --> 00:04:32,790
I just typed in our drop table.

73
00:04:32,820 --> 00:04:33,890
If exists.

74
00:04:34,060 --> 00:04:34,590
OK.

75
00:04:34,800 --> 00:04:38,600
And then here I put a space here plus table computer.

76
00:04:38,610 --> 00:04:44,600
So here I refer to my table computer and as you can see here we've got other arguments.

77
00:04:44,610 --> 00:04:48,900
The old version this old version means the old version of our database.

78
00:04:49,050 --> 00:04:52,320
And this new version means that the new version of our database.

79
00:04:52,320 --> 00:04:55,490
So as you can see here the old version as you can see is one.

80
00:04:55,590 --> 00:04:55,980
OK.

81
00:04:56,010 --> 00:05:00,930
Our current database version is one and if you want to update this application that and add another

82
00:05:00,930 --> 00:05:08,010
database to this application of the old version is going to be dropped here dropped drop believe exists.

83
00:05:08,160 --> 00:05:10,780
And the new version is going to be used instead.

84
00:05:10,950 --> 00:05:17,310
So as you can see here in line 50 free eyechart this uncreate D-B effort in order to create a new database.

85
00:05:17,310 --> 00:05:18,830
So hopefully that makes sense.

86
00:05:18,990 --> 00:05:21,280
But for this application we don't use.

87
00:05:21,410 --> 00:05:25,610
We don't actually need this Meffert but we need to actually write this method.

88
00:05:25,620 --> 00:05:28,940
Here are my escalate handler class.

89
00:05:28,950 --> 00:05:29,820
OK.

90
00:05:29,970 --> 00:05:31,430
So hopefully that makes sense.

91
00:05:31,590 --> 00:05:37,980
And now inside this class inside this school that handler class I need to actually provide some operations

92
00:05:38,010 --> 00:05:44,940
some efforts in order to for example add a computer object to the database or for example a deletes

93
00:05:45,000 --> 00:05:51,630
a computer object from the database or for example get all the objects that are inside the database

94
00:05:51,900 --> 00:05:55,160
and put them in for example in an other place.

95
00:05:55,170 --> 00:06:00,120
So here I'm going to actually pasting those methods and then I'm going explain to you what's going on

96
00:06:00,120 --> 00:06:00,650
here.

97
00:06:00,660 --> 00:06:07,530
So as you can see here these are the lines of code that I actually pasted here and in 9:59 as you can

98
00:06:07,530 --> 00:06:15,880
see I created a comment here and it says all database operations create Leatt update and delete as you

99
00:06:15,890 --> 00:06:16,900
can see here.

100
00:06:16,920 --> 00:06:23,250
So here the first of Meffert is going to actually create an object and then it's going to add that updating

101
00:06:23,250 --> 00:06:25,570
to the database into the database.

102
00:06:25,710 --> 00:06:29,500
OK so then those data are going to be saved.

103
00:06:29,690 --> 00:06:33,010
And we can access that data of what we want.

104
00:06:33,030 --> 00:06:33,490
OK.

105
00:06:33,600 --> 00:06:39,530
So the first one is create And as again see to the Access modify it of the Smif it is public.

106
00:06:39,570 --> 00:06:44,760
The return type of this method is void and this means that this is going to return Nuffield and the

107
00:06:44,760 --> 00:06:46,670
name of this method is at computer.

108
00:06:46,800 --> 00:06:51,270
So it's going to add the computer into the database and this it actually to access an argument of type

109
00:06:51,270 --> 00:06:57,000
computer as you can see we have a computer class inside our project and as you can see these are the

110
00:06:57,000 --> 00:07:02,620
instance variables and we've got the constructors and the getters and setters for our instance Friday.

111
00:07:02,910 --> 00:07:07,410
So I want to create a computer objects and put those objects into that database.

112
00:07:07,410 --> 00:07:08,280
Right.

113
00:07:08,280 --> 00:07:15,240
So the first one is going to do that creation for me at the computer and inline 64 inside the Smurfit.

114
00:07:15,360 --> 00:07:16,900
Let's see what's going on here.

115
00:07:16,920 --> 00:07:23,040
The first method the first actually the first line of code inside the sniffer is actually creating an

116
00:07:23,130 --> 00:07:26,270
object of type as it's like database.

117
00:07:26,280 --> 00:07:29,170
OK so here I want to access the Kulik database.

118
00:07:29,190 --> 00:07:29,730
OK.

119
00:07:29,980 --> 00:07:33,850
Is Q Like database and the name of this object is database.

120
00:07:33,900 --> 00:07:35,600
So I want to access the database right.

121
00:07:35,730 --> 00:07:37,370
Assignment operator.

122
00:07:37,590 --> 00:07:43,720
So here I am actually referring to the name of my to the name of this class.

123
00:07:43,750 --> 00:07:45,340
It is too late handler class.

124
00:07:45,360 --> 00:07:46,230
This is very important.

125
00:07:46,230 --> 00:07:48,960
You need to refer to the name of this class.

126
00:07:49,000 --> 00:07:54,660
It is too late handler class that does not get rewriteable database.

127
00:07:54,840 --> 00:07:58,080
So here I want to actually get the right level.

128
00:07:58,110 --> 00:08:01,950
And this means that all you want to actually add some data.

129
00:08:02,190 --> 00:08:07,060
I want to write some data into the database so I need to get the right get the right abilities.

130
00:08:07,170 --> 00:08:11,850
If you've got an other method and its name is get a readable database and this method and that if it

131
00:08:11,850 --> 00:08:15,360
is going to be used whenever you want to actually read some data in the database.

132
00:08:15,450 --> 00:08:19,240
But here I want to add an object of type computer into the database.

133
00:08:19,320 --> 00:08:24,930
So I need to get this get a little bit database here like table database is very important for dismiss

134
00:08:24,930 --> 00:08:25,180
it.

135
00:08:25,260 --> 00:08:25,920
OK.

136
00:08:26,280 --> 00:08:32,340
I could actually get it at this my Estulin handler class and then instead of this this here is actually

137
00:08:32,340 --> 00:08:32,750
enough.

138
00:08:32,760 --> 00:08:33,100
OK.

139
00:08:33,120 --> 00:08:35,650
These that get the right ability.

140
00:08:35,850 --> 00:08:40,230
So this up this keyboard actually refers to the name of this class.

141
00:08:40,300 --> 00:08:47,790
Is your late handler so as you can see in sixty 65 I created another object and the name of this object

142
00:08:47,790 --> 00:08:49,460
is content values.

143
00:08:49,680 --> 00:08:55,310
And as you can see I assigned a value on a values for the name of this object.

144
00:08:55,320 --> 00:08:56,050
OK.

145
00:08:56,160 --> 00:09:00,250
Values assignment operator new contents values.

146
00:09:00,270 --> 00:09:06,120
So here I created an object and its name is values which is actually of type content values.

147
00:09:06,240 --> 00:09:06,770
OK.

148
00:09:06,960 --> 00:09:10,380
So let's see how we can use this object in line 66.

149
00:09:10,470 --> 00:09:14,560
I refer to the name of this values object that puts.

150
00:09:14,610 --> 00:09:18,470
So you want to actually put some data into these values right.

151
00:09:18,510 --> 00:09:21,510
So values that puts Cullom computer name.

152
00:09:21,510 --> 00:09:24,240
So the first argument is going to be the Cullom.

153
00:09:24,240 --> 00:09:29,770
So for the Cullom computer name you want to assign the value computer that gets a computer name.

154
00:09:29,910 --> 00:09:36,100
You want to assign a value computer name for this column Cullom computer name and inline 6 to 7.

155
00:09:36,100 --> 00:09:39,380
Again I actually refer to the name of this values object that pute.

156
00:09:39,600 --> 00:09:42,050
So I want to assign a value to these values right.

157
00:09:42,090 --> 00:09:45,090
So values that puts Cullom computer type.

158
00:09:45,140 --> 00:09:50,610
So for this color I want to assign the value computer as you can see I am referring to the name of this

159
00:09:50,670 --> 00:09:51,720
argument right.

160
00:09:51,750 --> 00:09:54,070
Computers that gets computer type.

161
00:09:54,420 --> 00:09:54,660
OK.

162
00:09:54,720 --> 00:10:00,770
In this way I am actually getting the computer and the computer type and then inlight 69 as you can

163
00:10:00,770 --> 00:10:08,340
see I refer to the name of this database object that I actually did it created inline 64 database that

164
00:10:08,440 --> 00:10:09,500
in there.

165
00:10:09,920 --> 00:10:14,010
As you can see this effort is going to actually accept the arguments.

166
00:10:14,030 --> 00:10:16,430
The first one is table computer.

167
00:10:16,490 --> 00:10:18,330
This is the name of the table.

168
00:10:18,350 --> 00:10:24,560
So if you want to actually put those data up the date of the computer object into this table computer

169
00:10:24,560 --> 00:10:25,080
right.

170
00:10:25,090 --> 00:10:26,340
So table a computer.

171
00:10:26,360 --> 00:10:28,200
The second argument is null.

172
00:10:28,460 --> 00:10:34,840
OK so now let me actually call this method here again database that inserts and as you can see here.

173
00:10:34,970 --> 00:10:37,240
Does this mean for you to access the argument.

174
00:10:37,340 --> 00:10:40,010
The first one is table which we actually assign here.

175
00:10:40,100 --> 00:10:46,060
And the second one is gnarl column Hach which we don't actually use that in our application.

176
00:10:46,160 --> 00:10:51,990
And the first one is values which is actually of type content values that be created in line 65.

177
00:10:52,190 --> 00:10:57,600
OK so let me read this line of code here and here as you can see for the first argument I actually assigned

178
00:10:57,600 --> 00:10:59,840
a value of values here as you can see.

179
00:11:00,110 --> 00:11:08,360
So here I actually inserted these values into their database and in line 70 72 I need to actually close

180
00:11:08,360 --> 00:11:11,020
this database so the database that close.

181
00:11:11,360 --> 00:11:13,060
So hopefully that makes sense.

182
00:11:13,170 --> 00:11:18,320
And now I'm going to paste another method here and then I'm going to explain to you what's going on

183
00:11:18,320 --> 00:11:18,760
here.

