Android - Image picker doesn't work on Kindle

2019-04-28 07:46发布

问题:

I have the following code to display an imagepicker. After user picks an image onActivityResult gets called, to return me the data for the selected image.

On kindle however, I get a resultCode of 0, and data as null. Anyone else has noticed this problem before? This problem happens only on kindle fire.

startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), SELECT_PICTURE);

回答1:

I'm running into this exact same issue. Prior to the recent Kindle Fire update, which happened a few days ago for me, picking images from the gallery worked fine for me. So the most recent Kindle Fire update must have introduced this bug.



回答2:

You can get data back from such calls in two ways: either in the actual intent data, or in Intent.EXTRA_STREAM. If you get something back in EXTRA_STREAM it will be a mediastore content:// URL which you'd use a Cursor to look up.