Question

How can I implement a method in a separate thread that performs the transfer of files between folders on Android, and after transferring this file to be deleted from the source folder?

Was it helpful?

Solution

Some hints:

  1. You can use AsyncTask to do something on a separate thread.
  2. Think whether you wil be dealing with files in internal or external storage. If latter, you'll need to specify a permission in your manifest file.
  3. A simple way of moving a file to a new location:

    File file = new File(filename);

    boolean success = file.renameTo(new File(newName));

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top