private static void copyDataBase(Context context) { Log.i("[QDataBaseHelper]","copyDataBase start"); try { // Open your local db as the input stream InputStream myInput = context.getAssets().open(DB_NAME); // Path to the just created empty db String outFileName = DB_PATH + DB_NAME; File file = new File(outFileName); if (!file.getParentFile().exists()){ file.getParentFile().mkdirs(); } // Open the empty db as the output stream OutputStream myOutput = new FileOutputStream(outFileName); // transfer bytes from the inputfile to the outputfile byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer)) > 0) { myOutput.write(buffer, 0, length); } // Close the streams myOutput.flush(); myOutput.close(); myInput.close(); } catch (IOException e) { e.printStackTrace(); Log.i("[QDataBaseHelper]","IOException"+e.toString()); } Log.i("[QDataBaseHelper]","copyDataBase complete"); }