I don’t quite understand what you want to ask. Are you referring to the issue of dynamic permission application? If you are really too lazy to adapt to dynamic permissions, then set TargetSDKVersion to a value less than 23
This method returns a File[] array. If an external SD card is inserted, the length will be 2. The File with subscript 1 is the Android Data directory of the external SD card.
Then loop file.getParentFile() until the name of the current File is equal to Android, and you will get the root directory of the external SD card.
I don’t quite understand what you want to ask. Are you referring to the issue of dynamic permission application? If you are really too lazy to adapt to dynamic permissions, then set TargetSDKVersion to a value less than 23
Context.getExternalFilesDirs();
This method returns a File[] array. If an external SD card is inserted, the length will be 2. The File with subscript 1 is the Android Data directory of the external SD card.
Then loop file.getParentFile() until the name of the current File is equal to Android, and you will get the root directory of the external SD card.
Is there a lot of list files? File reading and writing are time-consuming operations, try asynchronous processing