In Android, how do I query MediaStore only for files in a specific path? Or alternatively, only display files in a certain path?

后端 未结 2 1011
挽巷
挽巷 2021-02-06 12:44

Suppose I have an Android block of code that looks something like this:

String[] proj = {MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media._ID};
int[] to = n         


        
2条回答
  •  忘了有多久
    2021-02-06 13:24

    MediaStore.MediaColumns.DATA is what you are looking for something like 'FILE_PATH'.

    So file path can be retrieved by

    String filePath = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA));
    

提交回复
热议问题