Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using custom file for Android sqlite database

Tags:

android

sqlite

Is it possible to choose a custom location for the sqlite database file?

If possible I want to store the database file in the memory card. And if user switches from one memory card to the other I want my application to use whatever version of the database file available on the card.

like image 329
Szere Dyeri Avatar asked Feb 05 '10 23:02

Szere Dyeri


People also ask

How do I create a DB file in SQLite?

In SQLite, the sqlite3 command is used to create a new database. Syntax: sqlite3 DatabaseName. db.


1 Answers

By default your database is stored in data/data/your_package/databases

You can use SQLiteDatabase openOrCreateDatabase where you can supply the path to your custom database as your first argument.

like image 130
Anthony Forloney Avatar answered Sep 28 '22 00:09

Anthony Forloney