O'Reilly logo

Android SQLite Essentials by Vikash Kumar Karn, Sunny Kumar Aditya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A database handler and queries

We will build our support class that will contain methods to read, update, and delete data as per our database requirements. This class will enable us to create and update the database and will act as our hub for data management. We will use this class to run SQLite queries and send across data to the UI; in our case, a listview to display the results:

public class DatabaseManager { private SQLiteDatabase db; private static final String DB_NAME = "contact"; private static final int DB_VERSION = 1; private static final String TABLE_NAME = "contact_table"; private static final String TABLE_ROW_ID = "_id"; private static final String TABLE_ROW_NAME = "contact_name"; private static final String TABLE_ROW_PHONENUM = "contact_number"; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required