How to access an existing sqlite database in Android?

Viewed 77625

So far we have developed apps in android that create database on runtime. We like to know how can we access a pre-built or existing database/sqlite file in our android app? Please provide detail

4 Answers

Take a look at the documentation for android.database.sqlite.SQLiteDatabase.

In particular, there's an openDatabase() command that will access a database given a file path.

SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null, 0);

Just specify the path to your database as the path variable, and it should work.

Related