SQLite Android cannot open database file

后端 未结 5 1233
夕颜
夕颜 2021-01-18 13:34

Edit: I tried this on my phone and it works, can anyone tell me why it does not work on an emulator?

I am trying to open a database on android, but it is throwing an

5条回答
  •  不思量自难忘°
    2021-01-18 14:24

    try this on your constructor

    public youeConstructor(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
            context.openOrCreateDatabase(DATABASE_NAME, context.MODE_PRIVATE, null);
        }
    

提交回复
热议问题