android - 安卓6.0以上外置sd卡读取
高洛峰
高洛峰 2017-04-18 09:14:20
0
3
519

安卓6.0后读取外置sd卡时权限限制,找了好多方法只能获取内置sd卡,后面找到一个,但是读外置sd卡里的内容显示列表时卡顿,求大神指点!

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
小葫芦

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template