I am getting my database file by this code
File dbFile=getDatabasePath("EdsysEyfsDB.db");
Log.v("database name checking", dbFile.toString());
I want to copy this database file to sdcard so I can do some operation for that. But I can't do any operation on that. The below code is using for copy to sd card
if (dbFile.exists()) {
InputStream inStream = new FileInputStream(dbFile);
String file = Environment.getExternalStorageDirectory().getPath()
+"/" + "database.db";
Log.d("file name checking in dbFilecondition", file);
FileOutputStream fs = new FileOutputStream(file);
byte[] buffer = new byte[1444];
while ((byteread = inStream.read(buffer)) != -1) {
bytesum += byteread;
fs.write(buffer, 0, byteread);
}
inStream.close();
fs.close();
}
But I am not going in this condition.The database file name is coming properly on LogCat. I already give permission for Read and Write file.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…