简体   繁体   中英

Transfer files between folders on Android

如何在单独的线程中实现一种方法,该方法在 Android 上的文件夹之间执行文件传输,并在传输此文件后从源文件夹中删除?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM