( ), ( ). "cleantestdatabase.db". "testdatabase.db", , reset . :
copyFile("cleantestdatabase.db", "testdatabase.db");
private void copyFile(String source, String dest) throws IOException{
String rootPath = Environment.getExternalStorageDirectory().getAbsolutePath() + getActivity().getString(R.string.default_dir);
File newDir = new File(rootPath);
boolean result = newDir.mkdir();
if(result == false){
Log.e("Error", "result false");
}
InputStream in = new FileInputStream(rootPath + source);
File outFile = new File(rootPath + dest);
if(outFile.exists()) {
outFile.delete();
}
outFile.createNewFile();
OutputStream out = new FileOutputStream(outFile);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}