MediaScannerConnection#scanFile converts directories into files when accessing them with USB-MTP on Android 5 Lollipop

久未见 提交于 2019-11-29 10:31:53

I ended up creating a dummy text file in each directory I wanted to make visible, and use scanFile on the file.

1) create directory, but don't "scan" directories

2) copy file to directory

3) run scanFile on the filePath

MediaScannerConnection.scanFile (_application, new String[] { filePath }, null, null);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!