In my android application i want to copy the media images to another folder(in my below code i try to copy picture from "/mnt/sdcard/DCIM/Camera/my_photo.jpg" to "/mnt/sdcard/PortFolio/MyGallery/ . I tried this with the following code but it doesn't work. Someone help me out of this??? Is there any other way possible??
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
if (sd.canWrite()) {
String sourceImagePath= "/mnt/sdcard/DCIM/Camera/my_photo.jpg";
String destinationImagePath= "/mnt/sdcard/PortFolio/MyGallery/";
Log.d("destinationImagePath", ""+destinationImagePath);
File source= new File(data, sourceImagePath);
File destination= new File(sd, destinationImagePath);
Log.d("before copying", "");
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();
}