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?

有帮助吗?

解决方案

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));

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top