How to copy folders from internal storage to other locations on Android

Asked 2 years ago, Updated 2 years ago, 80 views

How do I copy folders on my internal storage on Android?
For example,

/sdcard/Download

The folder called test in

/sdcard/

It's like copying up to .

android

2022-09-30 21:12

1 Answers

If it is internal storage, the basic operation is the same as copying folders by recursive invocation in Java.I will omit this because it is easy to find it if you look online.However, sometimes it is missing, so if you add it up, you need to check the path so that it does not become a circular reference.Otherwise, a circular copy (copy is an infinite loop) can occur.

Copy on Android requires media scanning of the files during the recursive process described above.Otherwise, for example, image files and music files in the destination folder will not be recognized by other apps until the device is restarted.Android maintains various file paths in the database for each type, and this phenomenon occurs because it is read from the application and used.This is recommended because scanning with MediaScannerConnection.scanFile is the easiest.


2022-09-30 21:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.