开发者

android: sqlite database empty after phone restart or kill per taskmanager

开发者 https://www.devze.com 2023-02-06 20:23 出处:网络
i have created a database in my android app: Context context = this.getApplicationContext(); SQLiteDatabase db;

i have created a database in my android app:

Context context = this.getApplicationContext();
SQLiteDatabase db;
String path = "cul开发者_开发知识库tura.db";
db = context.openOrCreateDatabase(path, Context.MODE_WORLD_WRITEABLE, null);

ok if my app is killed by task manager or the phone is restarted the database is empty. does anyone have a solution????


The code to create a database is as follows :

SQLiteDatabase sampleDB = null;

sampleDB = this.openOrCreateDatabase(Constants.DB_NAME, MODE_PRIVATE, null);

The database shouldn't be empty even if the phone is restarted.

Did you properly created the tables & inserted the values ?

0

精彩评论

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