开发者

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 emulato开发者_如何学JAVAr? and also is the database path of the SDCard and the DB path of the device memory different??


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(..)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜