ERROR : MM-DD HH:MM:SS 8379 8379 E libc : access denied finding property "re.vendor.pref_scale_resolution"
public class DatabaseHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "pms.db"; private static final String DATABASE_PATH = "/data/data/com.pms.app/databases/"; public DatabaseHelper(@Nullable Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); this.context = context; createDb(); } // public void createDb(){ boolean dbExist = checkDbExist(); if(!dbExist){ this.getReadableDatabase(); copyDatabase(); } } private boolean checkDbExist(){ SQLiteDatabase sqLiteDatabase = null; try{ String path = DATABASE_PATH + DATABASE_NAME; sqLiteDatabase = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READONLY); } catch (Exception ex){ } if(sqLiteDatabase != null){ sqLiteDatabase.close(); return true; } return false; } private void copyDatabase(){ try { InputStream inputStream = context.getAssets().open(DATABASE_NAME); String outFileName = DATABASE_PATH + DATABASE_NAME; OutputStream outputStream = new FileOutputStream(outFileName); byte[] b = new byte[1024]; int length; while ((length = inputStream.read(b)) > 0){ outputStream.write(b, 0, length); } outputStream.flush(); outputStream.close(); inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } private SQLiteDatabase openDatabase(){ String path = DATABASE_PATH + DATABASE_NAME; db = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READWRITE); return db; } public void close(){ if(db != null){ db.close(); } } }///
private boolean checkDataBase() { File databasePath = context.getDatabasePath(DATABASE_NAME); return databasePath.exists(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)