Saturday , February 23 2019
Home / Android / Android SQLite Database Tutorial

Android SQLite Database Tutorial

SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite is a very light weight database. In this tutorial I’ll be discussing how to write classes to handle all SQLite operations.

In this tutorial I am taking an example of storing products in SQLite database. I am using a table called Products to
store user products. This table contains three columns id (INT), name (TEXT), price(TEXT).

Writing Product Class

Before you go further you need to write your Product class with all getter and setter methods to maintain single product as an object.

Writing SQLite Database Handler Class

We need to write our own class to handle all database CRUD(Create, Read, Update and Delete) operations.

1. Create a new project by going to File ⇒ New Android Project.
2. Once the project is created, create a new class in your project src directory and name it as ( Right Click on src/package ⇒ New ⇒ Class)
3. Now extend your class from SQLiteOpenHelper.




About admin

Check Also

Android Activity Launch Modes

Launch mode is an instruction for Android OS which specifies how the activity should be ...

Leave a Reply