Converting file:// scheme to content:// scheme

后端 未结 3 926
孤独总比滥情好
孤独总比滥情好 2021-01-03 00:07

I am running to the problem with using Droid X\'s Files app and Astro file manager to select an image file. This two apps return the selected image with the scheme \"file://

3条回答
  •  失恋的感觉
    2021-01-03 00:44

    You probably want to convert content:// to file://

    For gallery images, try something like this:

    Uri myFileUri;
    Cursor cursor = context.getContentResolver().query(uri,new String[]{android.provider.MediaStore.Images.ImageColumns.DATA}, null, null, null);
    if(cursor.moveToFirst())
    {
        myFileUri = Uri.parse(cursor.getString(0)).getPath();
    }
    cursor.close
    

提交回复
热议问题