开发者

how to add xxx.db file into my project in android

开发者 https://www.devze.com 2023-01-04 13:42 出处:网络
i have xxx.db (SQLite file) where i want to add him to my android app in my android app under src i open new directory where i add \"test.db\"

i have xxx.db (SQLite file) where i want to add him to my android app in my android app under src i open new directory where i add "test.db"

then in my app what should i write in order to get the db ?

String myPath = "com.countryCityGame/databases/test.db";
SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);

i am sure mypath is spelled wrong ' what is the curren开发者_运维知识库t position of the dp file once the app is inside the emulator . should i insert the db into the manifest or somehing else ? thanku


All databases that stored on phone not on SDCard are located in /data/data/com.PackageName/databases/test.db

See this tutorial for using your own database in Android

0

精彩评论

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