Hey there.
Let's implement the following functionality.
They've lost all their current operation is delete.
Let's create a method for these.
Public void.
This method will not return anything.
Delete car and we will pass the object of the Car class again.
We must get the right to build the base object since we will change the database.
So we need to write the book database.
Let's scope and paste and continue.
Call delete for this object.
Method and inside this method we will use the same parameters that are here and update.
With the exception of these parameter content values since we do not put anything here we indicate the
name of the table.
Then QED.
Then sign equals an equation and string array with one value.
Where we put the idea that we give for on the method parameter then to be close let's check how this
method works.
And so let's return to all main activity and let's remove this code.
Comment on it.
And on comment.
This code in which we display all the elements of our database.
Let's run
and since I added the same elements several times I have a fairly large number of them let me clean
so that everything is more clear and restart.
And so you see we have eighty four elements now.
Well it's
it was possible not to comment so that the elements would not be added anymore.
And let's try to delete for example again the first element that is let's extract
in the object of class car from the database entry under idea one that is it will be this Tesla and
then delete this object from the database we write.
Database handler delete car and put this object that all we need to output a little log.
Now after this code after the record is deleted.
So here we have a conflict of variable names because we already have car here.
Let's take a name it let's call it deleting call for example
and here to deleting.
And then everything is correct.
And let's try to run
so let's see
let's clear start again.
No we had on there.
Oh of course because we get a call with Idea 1
which we have already deleted.
It is not in the database so let's comment on this code again now.
And c we simply display information about all the records and see the record with no one has gone with
either one
and so all the information is displayed.
And as you can see a car with ideas 1 has removed from the database.
Again we can't comment
and try to delete for example with Ida 7 let it be
Let's run
the information is not updated immediately.
You need to round it again.
So let's comment out again so that there is no mistake
Kahlil.
Cut and Run.
Let's see and so there are six and not seven eight is it goes immediately.
That is we managed to implement matter delete and let's create another method in our database handler
which will return the number of all brackets contained in our table so right.
Public int get cast count
again.
Create Esko line database
assign these get readable database since we will read will not write and I think in this case next script
the string can't query name it and write the following s girl.
Select all cities for all
the name of the table
and put in the cursor value extracted using Debbie raw query count query and null pass the second parameter
and then we return cursor gets called and returned the normal frigates located in our coastal.
Now this call this method in main activity we can do it here.
For example recorded
in the log class called and database handler get cards called.
But since the integer value is returned we need to specify a string.
So right string value all and food
eat inside
and let's from now
so let's see.
Let's clear because there are too many interests and lunch once again and here you need to specify costs
count of course.
So.
Eighty two.
Interests.
Let's see we have a last I.D. eighty four.
But as you remember we deleted two records.
That's why everything is true.
Cost Guard we have eighty two.
So we implemented all the basic operation with the.
Working with the database so-called corrupt operations.
Create the right update and delete.
And another method was implemented which would turn the number of records in the database and then we
can proceed to work on our app.
The application of sport clock.
See you in the next video.