In this android database tutorial we will learn how to use sqlite database in android app.Inserting, deleting of values are shown with a detailed example.

Firstly SQLite DB is a type of database which is stored within the mobile/device of the user. It is a simple database which is also a light-weight db which is used by most of the users to save and retrieve data.

We will be seeing different types of databases in further android development tutorials, this tutorial deals with inserting color names into database, retrieving them and also deleting them from db.

Creating a SQLite Database

 

Now, we will write a sql query to create a database using above DB_NAME and DB_TABLE

 

SQLiteAdapter.java

 

Inserting Data into Database

 

No we try to insert data into database

 

By using edittext i am storing values into database, storing them and retrieving them.

 

MainActivity.java

 

 

Creating Layout File

Now add the buttons in layout file such that these two buttons will be used to add and delete values from database.

And also a edittext to get user input.

 

activity_main.xml

 

 

AndroidManifest.xml

Show Buttons
Hide Buttons
Read previous post:
Android Tutorial on Webview for Beginners

Close