I have created a SQLite file and putted it on to assets folder. Now I am able to read the data from that file but I don\'t have any idea how to write to this database file.
you need to copy database file from asset and paste in /data/data/''/databases/ folder
private static String DB_NAME = "QuotesData.db";
private static String DB_PATH = "/data/data/[PACKAGE NAME]/databases/";
private void copyDataBase() throws IOException {
InputStream myInput = context.getAssets().open(DB_NAME);
String outFileName = DB_PATH + DB_NAME;
OutputStream myOutput = new FileOutputStream(outFileName);
byte[] buffer = new byte[1024];
int length;
while ((length = myInput.read(buffer)) > 0) {
myOutput.write(buffer, 0, length);
}
myOutput.flush();
myOutput.close();
myInput.close();
}
In Above code : Replace [PACKAGE NAME ] with your package name I hope above code will help.
Thank You