I use this code to work with SQLite.
Before I upgrade to android 6.0, it works fine, but now it crashes.
in class MyParam
public static SQLiteDatabase dbMyCount; public static String DB_Path_MyCount = "/sdcard/GMS/MyCount.db";
on MainActivity
MyParam.dbMyCount = this.openOrCreateDatabase(MyParam.DB_Path_MyCount, MODE_WORLD_WRITEABLE, null); SQL = "CREATE TABLE IF NOT EXISTS MyCount(_id INTEGER PRIMARY KEY AUTOINCREMENT,Tdate VARCHAR,Cust VARCHAR,"; SQL += "Prog VARCHAR,CustCode VARCHAR,OpenCode VARCHAR,Memo VARCHAR)"; MyParam.dbMyCount.execSQL(SQL);
I also updated my manifest for this:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
But the error still appeared:
Error code: 1294 (SQLITE_CANTOPEN_ENOENT) Called: The specified directory or database file does not exist. (unknown error (code 1294): Failed to open the database)
I searched the Internet and did not find an answer or solution.
Thanks.
source share