So the access modify it is public as you can see here.
And the name of the constructor must be the same as the name of our class.
So I just know that type been here my school like handler and inside apprentices I need to provide an
argument of type context as you can see here.
And the name of this argument is going to be context and that I need to open and close this constructor
by using these curly braces.
And here as you can see we have an error and this error is because of the constructor of the superclass.
So we need to actually call the constructor of the superclass.
So I just need to type in here super at inside Apprentice's.
I need to provide some values.
The first value that I need to provide here is actually context comma and the second argument that I
need to provide is actually the name of the database.
So here I just need to type in database name.
So here I actually fell to the name of these constants that I actually created in line 17 as you can
see here.
I specified the name of the database so computer that.
This is the name of my database right.
So for the second argument I need to provide the database name karma.
And for the first argument I assign the value null.
So let's actually hold the command key and then click on the super here.
So if you are using I mean those machine just hold the control key.
And then click on the super here.
And as you can see here we have these a constructor here and this constructed here.
So as you can see here we are actually calling this a first constructor.
This first constructed of the superclass is q like open helper.
The first one is context.
The second one the name of the database.
OK database name and the first one is cursor factory.
So for the cursor factory I assigned the value not because we don't need a cursor factory for this application.
OK.
And for the first argument we need to actually provide the database version.
OK so here as you can see for the first argument which is actually across a factory which we don't need
that in the application I assign the value null and I put a comma here and there for the fourth argument
I assigned the value database version.
So here I need to specify the version of the database.
So as you can see here the error is gone.
Right.
So now I need to actually overwrite some of the methods that are actually inside of this is like open
helper class.
And as you can see here it says class is school that handler must be declared abstract or implement
abstract method of great and the uncreate in a school like open helper.
So here as you can see we've got two methods that we need to actually override here inside our school
like handler class.
The first one is actually uncreate and if it says this is the method that we need to provide for this
why is q late handler class.
So as you can see here is the name of this method is uncreate.
And as you can see this if it actually to accept an argument which is of type A school like database
and the name of this argument is the B.
So here inside the Smurfit I can just refer to the name of this db here D-B argument which is of type
as school database that executes execute as well as you can see here and here in say the practice of
this method.
I can just refer to the name of this string valuable.
Create a computer table create computer table.
OK so now it can actually create a computer table for us.
OK for this application this is really important.
You need to put this value here.
OK.
Otherwise it's not going to actually create a table for our application.
OK.
So now I need to overwrite the upgrade Smurfette upgrade here and this method is going to be called.
For example when you happen when you actually upload or your application to the Google Play store and
venue and for example two months later you want to update your application and you want to actually
change your database.
This limit is for that situation.
So you need to actually drop the current database and then create a new database.
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
on here.
So as you can see here these are the lines of code that I actually pasted here inside this on upgrade
Befort.
And as you can see ighly further to the name of this argument which is of type Escuela database db that
execute as well as you can see here and inside the double quotes.
I just typed in our drop table.
If exists.
OK.
And then here I put a space here plus table computer.
So here I refer to my table computer and as you can see here we've got other arguments.
The old version this old version means the old version of our database.
And this new version means that the new version of our database.
So as you can see here the old version as you can see is one.
OK.
Our current database version is one and if you want to update this application that and add another
database to this application of the old version is going to be dropped here dropped drop believe exists.
And the new version is going to be used instead.
So as you can see here in line 50 free eyechart this uncreate D-B effort in order to create a new database.
So hopefully that makes sense.
But for this application we don't use.
We don't actually need this Meffert but we need to actually write this method.
Here are my escalate handler class.
OK.
So hopefully that makes sense.
And now inside this class inside this school that handler class I need to actually provide some operations
some efforts in order to for example add a computer object to the database or for example a deletes
a computer object from the database or for example get all the objects that are inside the database
and put them in for example in an other place.
So here I'm going to actually pasting those methods and then I'm going explain to you what's going on
here.
So as you can see here these are the lines of code that I actually pasted here and in 9:59 as you can
see I created a comment here and it says all database operations create Leatt update and delete as you
can see here.
So here the first of Meffert is going to actually create an object and then it's going to add that updating
to the database into the database.
OK so then those data are going to be saved.
And we can access that data of what we want.
OK.
So the first one is create And as again see to the Access modify it of the Smif it is public.
The return type of this method is void and this means that this is going to return Nuffield and the
name of this method is at computer.
So it's going to add the computer into the database and this it actually to access an argument of type
computer as you can see we have a computer class inside our project and as you can see these are the
instance variables and we've got the constructors and the getters and setters for our instance Friday.
So I want to create a computer objects and put those objects into that database.
Right.
So the first one is going to do that creation for me at the computer and inline 64 inside the Smurfit.
Let's see what's going on here.
The first method the first actually the first line of code inside the sniffer is actually creating an
object of type as it's like database.
OK so here I want to access the Kulik database.
OK.
Is Q Like database and the name of this object is database.
So I want to access the database right.
Assignment operator.
So here I am actually referring to the name of my to the name of this class.
It is too late handler class.
This is very important.
You need to refer to the name of this class.
It is too late handler class that does not get rewriteable database.
So here I want to actually get the right level.
And this means that all you want to actually add some data.
I want to write some data into the database so I need to get the right get the right abilities.
If you've got an other method and its name is get a readable database and this method and that if it
is going to be used whenever you want to actually read some data in the database.
But here I want to add an object of type computer into the database.
So I need to get this get a little bit database here like table database is very important for dismiss
it.
OK.
I could actually get it at this my Estulin handler class and then instead of this this here is actually
enough.
OK.
These that get the right ability.
So this up this keyboard actually refers to the name of this class.
Is your late handler so as you can see in sixty 65 I created another object and the name of this object
is content values.
And as you can see I assigned a value on a values for the name of this object.
OK.
Values assignment operator new contents values.
So here I created an object and its name is values which is actually of type content values.
OK.
So let's see how we can use this object in line 66.
I refer to the name of this values object that puts.
So you want to actually put some data into these values right.
So values that puts Cullom computer name.
So the first argument is going to be the Cullom.
So for the Cullom computer name you want to assign the value computer that gets a computer name.
You want to assign a value computer name for this column Cullom computer name and inline 6 to 7.
Again I actually refer to the name of this values object that pute.
So I want to assign a value to these values right.
So values that puts Cullom computer type.
So for this color I want to assign the value computer as you can see I am referring to the name of this
argument right.
Computers that gets computer type.
OK.
In this way I am actually getting the computer and the computer type and then inlight 69 as you can
see I refer to the name of this database object that I actually did it created inline 64 database that
in there.
As you can see this effort is going to actually accept the arguments.
The first one is table computer.
This is the name of the table.
So if you want to actually put those data up the date of the computer object into this table computer
right.
So table a computer.
The second argument is null.
OK so now let me actually call this method here again database that inserts and as you can see here.
Does this mean for you to access the argument.
The first one is table which we actually assign here.
And the second one is gnarl column Hach which we don't actually use that in our application.
And the first one is values which is actually of type content values that be created in line 65.
OK so let me read this line of code here and here as you can see for the first argument I actually assigned
a value of values here as you can see.
So here I actually inserted these values into their database and in line 70 72 I need to actually close
this database so the database that close.
So hopefully that makes sense.
And now I'm going to paste another method here and then I'm going to explain to you what's going on
here.