try {
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
if (sd.canWrite()) {
File BackupDir = new File(sd, "별메모장/");
BackupDir.mkdir();
File currentDB = new File(data, "//data//project.star_note//databases//Star_DB.db");
File backupDB = new File(sd, "별메모장/Star_BACKUP.db");
FileChannel src = new FileInputStream(currentDB).getChannel();
FileChannel dst = new FileOutputStream(backupDB).getChannel();
dst.transferFrom(src, 0, src.size());
src.close();
dst.close();
SimpleDateFormat formater1 = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREA);
Date current1 = new Date();
String backup = formater1.format(current1);
mPrefEdit.putString("backup", backup);
mPrefEdit.commit();
backup_data.setText(backup);
Toast.makeText(getApplicationContext(), "백업되었습니다.", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "백업 실패 ㅠㅠ", Toast.LENGTH_SHORT).show();
}
백업이 안되는데 소스코드에 문제가 있는걸까요??