Construct MediaStore URI for specific folder

后端 未结 3 2115
你的背包
你的背包 2020-12-11 07:45

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

3条回答
  •  无人及你
    2020-12-11 08:22

    Cursor mCursor = getContentResolver().query(
                       uri1, Selection, 
                       android.provider.MediaStore.Audio.Media.DATA + " like ? ", 
                       new String[] {str}, null);
    

    You might need to use "%"+str+"%" instead, because "Music-1" is just part of the MediaStore.Audio.Media.DATA.

提交回复
热议问题