Dear all,
To copy a file from a source directory to destination directory in a android device.
Use below code Snippets.
try {
File sd = Environment.getExternalStorageDirectory();
if (sd.canWrite()) {
File source= new File(copypath);
File destination= new File(pastepath);
if (source.exists()) {
FileChannel src = new FileInputStream(source).getChannel();
FileChannel dst = new FileOutputStream(destination).getChannel();
dst.transferFrom(src, 0, src.size());
src.close();
dst.close();
}
}
} catch (Exception e) {}