From 4e1acbe9f10d04ad091b732ec04ab941d5b356fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20Makovi=C4=8Dka?= Date: Wed, 14 Sep 2016 22:05:55 +0200 Subject: [PATCH] Fix SQlite open flags app.openOrCreateDatabase expects flags from android.content.Context which are completely different --- OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java b/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java index 17b410f1ec..431b3455f1 100644 --- a/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java +++ b/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java @@ -14,8 +14,9 @@ public class SQLiteAPIImpl implements SQLiteAPI { @Override public SQLiteConnection getOrCreateDatabase(String name, boolean readOnly) { - android.database.sqlite.SQLiteDatabase db = app.openOrCreateDatabase(name, - readOnly? SQLiteDatabase.OPEN_READONLY : (SQLiteDatabase.OPEN_READWRITE | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING), null); + android.database.sqlite.SQLiteDatabase db = SQLiteDatabase.openDatabase(app.getDatabasePath(name).getAbsolutePath(), null, + (readOnly? SQLiteDatabase.OPEN_READONLY : (SQLiteDatabase.OPEN_READWRITE | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING)) + | SQLiteDatabase.CREATE_IF_NECESSARY); if(db == null) { return null; }