Try popular Android Application by Feliz-Droid

Try popular Android Application by Feliz-Droid

Speaking Caller logo
Speaking Caller
Battery temperature logo
Battery Temperature
Dual Photo logo
Dual Photo
Ganesh Wallpapersl ogo
Lord Ganesh Wallpaper
Girly Pink Keyboard l ogo
Girly Pink Keyboard

Thursday, September 22, 2011

How to copy a file from a directory and move to another directory.

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());
        } catch (Exception e) {}

No comments:

Post a Comment