Hey there.
So let's start exploring not a basis that a basis let's go light mud before we begin to develop the
main application which I already told you the application or the sport club to get started.
Let's get acquainted with the escrow law database using a simple car database as an example.
This database will contain only one table and in this table as you can see contains one column.
This is identification number in escrow law database.
And when you add new database objects the idea increases automatically.
And that is when adding the first object it is assigned I.D. 1.
When I think the second two then three and so therefore we have the same thing.
The idea will be incremented automatically that is incremented by 1 and next.
The second field of our table is the name of the car.
And the third field is the price.
That is a very simplified table for example which we will get acquainted with a scroll light database.
Well let's get started developing our database.
I created a project called ID cards Debbie.
Debbie is the database of cars.
Let's create two separate new packages in our job package to structure our application.
This is a good practice.
It's all right.
Click on the job folder.
Then new package.
And here we select the main java okay and name then you package data or data.
And next another package
let's call it model.
And so let's start with the model package and create an eight hour model.
A class that will represent these lines in the table.
And the class will have the same fields as the columns in this table.
That is I.D. name and price.
Well it's great and new class in the package.
Call it car and a need grade.
Proud fields private int i d.
Private String
name
and private String
price.
Legit also maybe 3 Now let's create construct just for our class.
We can't press common and call the cons of select construction or another way we can right click on
the screen and on here you can select the same menu and a colleague constructor panel it's great.
The first constructor empty without parameters
the second constructor.
We will have with all parameters.
And third constructor
we will have both two parameters without I.D. next in the same way.
Create getters and setters with the help of which we can get the value of our fields on set.
Then
next in the data package let's create a new Java class.
Call it that a base handler
handle is such manage that is this is database management class with which we will access database data
okay.
Next we must inherit extends from the Esko allied
open helper class.
And of course we must implement the methods.
These two methods all create an on upgrade click Okay.
And as you can see there is still a red on the line.
And if we clique we still need to create a constructor or it's click here.
A few constructors here let's implement the first click okay and undo it studio automatically at Android
exultation knowledgeable.
Now we don't need it right now.
So as delete these annotations if you automatically added them to
and next we will create another package and call it utilize utilities auxiliary tools we'll be here.
And in the package create a new gel class.
Call it YouTube.
And here we will create a private static final constants to handle our database console.
Private static final int.
Call it the first constant database version
then you will see why we need this concept.
As you remember their constant static file final constants are written in capital letters and we'll
assign the virtual number one the following.
Private static final constant stream that base name
assign cars did be valid cars database and the next constant.
Private static final three table name
it's a sign that value cars.
Next we will create the same constants for the columns of power table for the name of each of the columns.
Copy this line for speed.
Let's insert three more.
And here we will write key I.D.
Yeah we will have key name
and here key price
and here we again specify a D name and price
we create these private static final constants.
We made them static so as not to not instantiate an object of the Utah class but access through the
class name to these constants and manipulate the database with them.
And so we created three packages with you.
We have created a model of our car our objects that will be stored in the database and we also create
created that base handler class which is in character from Esko light open helper class and in which
we will create and manage a database.
We will continue to develop the database in the next video do.