Prachi
Prachi

Reputation: 1004

knowing the location of the database in the SDCard of Android emulator

If i am creating any database in android, where does it gets stored in the SDCard of the emulator? and also is the database path of the SDCard and the DB path of the device memory different??

Upvotes: 0

Views: 597

Answers (2)

Eric Cloninger
Eric Cloninger

Reputation: 2260

You can specify an explicit path to the SD card in your openOrCreateDatabase() call. e.g.

SQLiteDatabase db = openOrCreateDatabase("/sdcard/myapp/mydb", MODE_PRIVATE, null);

Just make sure to test that /sdcard exists before you start writing to or reading from it.

Upvotes: 0

Jon Willis
Jon Willis

Reputation: 7024

Databases are by default stored in internal memory. On a real device like the Droid X, it will be stored somewhere /data/data/package.name.here/databases/dbname.extension

Also, look up Context.getDatabasePath(..)

Upvotes: 1

Related Questions