So as you can see here these are the lines of code that I actually pasted here and now I'm going to
explain to you what's going on here.
So as you can see here in line one hundred and five I created a comment and it says getting all the
computer objects.
So I want to actually get all the computer objects from the database.
So I created an effort here.
So the access modifier of this and if it is public and the return type of dismay if it is actually a
list.
OK a list is actually and arii.
OK.
Of computer objects.
So in the angle brackets you can see that I put this computer class here and this means that you want
to return a list of computer objects and array of computer objects from this method.
OK.
This is actually an interface.
So let's open the Android.
Let's open the documentation here.
I just need to search for the least.
Inside job the that you package we have this list here and now let's see what is this list here.
So let's actually read some of the descriptions and it says an ordered collection also known as a sequence
the user of this interface has precise control over where in the list each element is inserted.
The user can access elements by that integer index position in the list and search for elements in the
list.
This is actually an older collection of data.
Ok this is like aere.
OK.
And here as you can see that this is the name of this list computer release as you can see here inside
this map at least computer right.
And as you can see here it is.
If it does not accept any arguments this is the name of them if it get on the computers and inside them
if it created an object of type please list of computers so list and inserted in say the angle brackets
I put this computer and this is the name of my list computer list.
So because the return type of this method is a list here which actually retains computer objects.
I created this object here and this is the name of my object computer list and then I initialize this
object new alle list.
So I initialize these computerless object by actually using the class at a list.
OK.
So here in line one hundred and ten.
I created this strange object 3.
Select all query.
OK so you want to select all the objects from the database and I want to return those objects from this
method.
So I did because I actually put this comment.
Select space and then I put this start here this symbol from so select from space as you can see here
plus.
And I actually read through the name of the table table a computer.
This is really important to me to refer to the name of our table table computer so it can actually select
all the data on the table computer and in line.
Here it is 11 more hundred than 11.
It's like database.
So I created an object of type A school like database and the name of this object is database assignment
operator does that get right up at the top.
So I want to actually write some data through the database right.
But here as you can see this it is going to return computer objects.
OK.
We want to read data from the database.
This is going to return the rightabout database.
OK.
It's not necessary to use this method when we can actually use the get readable database instead because
we want we just want to read the data from the database and we can actually return that data.
So instead of write it write up a database.
I can get that through that database.
And here in line one hundred and twelve as you can see here.
I created this cursor here this cursor interface assignment operator database.
So I referred to the name of this database object that raw query.
So I want to I took the query data from the database right database that Brockwell is select or query.
So I refer to the name of this variable that actually holds this data.
OK.
Select all query for the first argument and for the second argument I assign the value not so that naturally
call this method here in order to show you the second argument database that a real query.
So as you can see here for the second argument as you can see here we could actually specify overclass
in order to specify that how you want to actually get the data from the database.
But in this case I just want to get all the objects from the database so I don't need to provide a where
class or selection or X in or for this for the Smurfit for the second argument.
So for the second argument I put a value on and here as you can see I created an if statement.
So if cursor that move to first inside this if statement I created this to while here to do.
And inside the curly braces here as you can see I created an object of type computer.
So computer computer assignment operator new computer.
So I created an object of type computer and as you can see here this constructed I didn't actually provide
the values.
So inside this computer class you can see that we have also an empty constructor.
OK.
So I can create an object for this computer class without providing arguments for this constructor.
As you can see I am actually referring to the name of this object that set I-T.
So I call this set id on this object integer that parse it.
So I referred to the name of this integer class that parsed it this if it is going to actually accept
an argument of type string and it's gonna convert that value to a integer value.
OK so integer does parse.
And here inside the apprentice's I need to provide a string value cursor that gets Thring zero.
So cursive that gets string 0 means the id the column Id.
OK.
And it's going to actually convert that string value to the integer value and you can actually provide
that value for this set id.
If it is related to this computed object and here in line one hundred and twenty one as you can see
computer that said computer name cursor that gets three in part number 1 so this number one refers to
the column computer name.
And we can actually get the computer name by using this method cursor that gets drunk.
And here as you can see computer that set computer type cursor that gets three too.
So this tool refers to computer type Cullom computer type.
And we can actually get this computer type and at the end I want to add this object this computer object
to the computer list.
So computer list as you can see here.
I created this object in line 108.
And inside this will do while loop here as you can see all you want to add this object to this computer
is so computer released that ad computer and at the end as you can see here you have this wide condition
so wide cursor that move to next.
So this means that if the cursor does not is not empty and we have data inside the database and we can
actually move to the next update in the database then it's going to execute this new while loop again
until it reaches the end of the objects into the database and we don't have any objects inside the database.
So it's not going to execute this of do I do it any more.
If the if the database is empty.
OK.
And at the end as you can see here at the end of this statement now you want to actually return the
computer released from the Smurfit.
Remember that if it needs to return a list of computer objects an army of computer objects.
So I just returned this computer list so hopefully that makes sense.
And now I'm going to paste in some other Mfat 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 paste that here.
And as you can see I created a comment here and it says updating a single computer.
So I want to actually update a single computer object inside the database and if over for example I
can actually change the computer name or the computer type ok but using this update method.
So public so the access modifier of the Smurfit is public.
The return type of the Smurfit is integer end and the name of this method is update the computer.
And this if it actually accepts an argument of the computer object as you can see here.
OK Computer here.
So insert the curly braces off this Nefert Let's see what's going on here.
First of all I actually created an object of think it's like database and the name of this object is
database.
I put an assignment operator here this that gets writable database.
So at this time because I want to actually change some data inside my database I need to actually get
the right level database.
I can't get the readable it up.
I need to get the write up a little way because I want to update computer objects inside the database
right.
And inline 110 of 46 as you can see.
I created an object of type content values and the name of this object is values assignment operator
new content values.
So I created this object which is actually of type content values and inline what.
One hundred and forty seven as you can see I referred to the name of this object values that put.
So I want to put some data inside these values object values that put color computer name.
So I want to actually get the computer name that is inside of the column computer name.
So this is actually the column for the first argument and for the second argument I just need to return
to this computed object that we receive as an argument from the Smurfit computer that gets computer
name.
As you can see here.
OK.
And here in line one hundred and forty eight.
I actually again referred to the name of this object of values that pute and for the first argument
I provided this column column computer type as you can see here.
So you want to get the computer type and for the second argument I just need to refer to the name of
this object computer that gets computer type.
So you to get the type of the computer here and here.
Inline 100 than 50 as you can see I want to return a value to return a value of type integer.
So I just need to put that literal keyword here database that update as you can see here because I want
to update the database I need to actually call this method database.
I actually get to the name of this database object that update.
So for the first argument I need to actually provide this value table computer I need to provide the
table of the database table computer and for the second Madie for the second argument I need to provide
these values object which is actually of type content values.
And for the sake and for the first argument I need to provide the where clause here where column Id
as you can see here plus operator and inside the double quotes as you can see here these are equal operator.
And this question mark and this means avare column Id is equal to and here as you can see for the fourth
argument I am actually providing an argument for this very close here for this class here.
OK the argument as you can see here for this class must be of type strange Ari so new string at a and
in say the curly braces as you can see I am providing disvalue streambed that the value of computer.
So here you refer to the name of this Optik computer that get ID.
OK so I want to actually update this specific computer object that is related to this specific ID.
OK.
So by putting this up ID here this column Id Plus does equal operator question mark.
And this idea here computer that get ID this means that we want to update the specific computer that
is related to this specific column Id.
As you can see here.
OK.
So in this way we are assured that we are actually updating their right computer object.
OK so this is very important that you pro-white an ID for your objects inside the database.
And here we are using that ID in order to actually specify that which one of the computer objects we
want to actually to update.
I want to update the computer object that is related to that specific ID computer that gets ID.
OK.
So hopefully that makes sense.
And if you have any questions please post the discussion in the course and then I do my best to answer
all of your questions.
And now I want to actually pasting and another fit and then I'm going to explain to you what's going
on here.