构建MediaStore URI的特定文件夹文件夹、MediaStore、URI

2023-09-12 10:24:27 作者:毁灭性喜欢

例如,如果有两个目录 / SD卡/音乐/音乐-1 / SD卡/音乐/音乐-2 如何构建一个URI来得到音乐-1 DIR为例。我可以使用 MediaStore.Audio.Media.EXTERNAL_CONTENT_URI 来获取所有外部存储设备,但是怎么做的伎俩只对特定目录的内容。

For example if a have two directories /sdcard/Music/Music-1 and /sdcard/Music/Music-2 how can I construct a URI to get the files in Music-1 dir for example. I can use MediaStore.Audio.Media.EXTERNAL_CONTENT_URI to get the content of all external storage but how to do the trick only for specific dir.

推荐答案

DATA 字段筛选的路径,构建波普尔 SELECT WHERE 语句相匹配的文件夹名称,您可以使用 SUBSTR 查询; - )

Filter the path from the DATA field and construct a poper SELECT WHERE statement to match the folder names, you can use SUBSTR in the query ;-)