[英]android: sqlite database empty after phone restart or kill per taskmanager
i have created a database in my android app: 我已经在我的Android应用程序中创建了一个数据库:
Context context = this.getApplicationContext();
SQLiteDatabase db;
String path = "cultura.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; SQLiteDatabase sampleDB = null;
sampleDB = this.openOrCreateDatabase(Constants.DB_NAME, MODE_PRIVATE, 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 ? 您是否正确创建了表并插入了值?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.