Not able to open database in read/write mode

前端 未结 3 1356
青春惊慌失措
青春惊慌失措 2020-12-17 21:07

I am getting below error:

not an error (code 0): Could not open the database in read/write mode.

I have added

          


        
3条回答
  •  北海茫月
    2020-12-17 21:23

    In Android API 4.3 and lower you can open databases in external SD Card, this code was working for read and write :

    SQLiteDatabase.openDatabase(DB_PATH, null,SQLiteDatabase.NO_LOCALIZED_COLLATORS);
    

    Starting from API 4.4 you only can open databases in external SD Card READ_ONLY, you have to use this code :

    SQLiteDatabase.openDatabase(DB_PATH, null,SQLiteDatabase.OPEN_READONLY);
    

    I hope this helps.

提交回复
热议问题