How to get path by MediaStore.Images.Media

后端 未结 2 1114
眼角桃花
眼角桃花 2020-12-20 02:38

I use below code to get the bitmap of all sd card photo.

String[] projection = {MediaStore.Images.Media._ID,MediaStore.Images.Media.DATA};  
Cursor cursor =          


        
2条回答
  •  情歌与酒
    2020-12-20 02:52

    Images.ImageColumns.DATA is the path

    How to use it:

    int image_column_index = cursor.getColumnIndex(MediaStore.Images.Media._ID);
    int image_path_index = cursor.getColumnIndex(MediaStore.Images.Media.DATA);
    //added ... 
    path[i] = cursor.getString(image_path_index);
    

提交回复
热议问题