开发者

App installation on the external storage. What will happen with the database?

My application uses SQL database. What will happen with the location of this database, if I declare android:installLocation="pre开发者_运维百科ferExternal" in the AndroidManifest? Will it be also stored on the external database? If no, then how should I handle this in my application? (ideally, if user moved the application, I should also move the database)


The .apk file is saved on the external storage, but all private user data, databases, optimized .dex files, and extracted native code are saved on the internal device memory.

from: http://developer.android.com/guide/appendix/install-location.html

the database will still remain on the internal storage of your phone. you don't have to handle this android will handle it for you


To answer that other question. if you want to bring have your database on the external storage use the SQLiteDatabase.openDatabase method with the path of the database as the paramters. check the following links. Ive found some examples for you take a look at them.

this is a good one!

Is it possible to move the internal DB to the SDCard?

heres another example.

http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

u might want to use the documentation as a reference.. Good luck!

http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#openDatabase(java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory, int, android.database.DatabaseErrorHandler)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜