I call:
Intent intent = new Intent(Intent.ACTION_PICK,
MediaStore.Images.Media.INTERNAL_CONTENT_URI);
intent.setType("image/*");
intent.putExtra("crop", "true");
intent.putExtra("scale", true);
intent.putExtra("outputX", 256);
intent.putExtra("outputY", 256);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("return-data", true);
startActivityForResult(intent, code);
then in my ActiviyResult():
if (requestCode == RESULT_LOAD_IMAGE && data != null) {
final Bundle extras = data.getExtras();
if (extras != null) {
//Get image
Bitmap profilePicBitmap = extras.getParcelable("data");
...
I try to get the uri by doing this:
data.getData()
but it always returns null
The problem is I need the path of the bitmap on the device so I can upload it elsewhere...but I can't get the path of it without having to convert it to uri. To convert to uri you have to request permission to write external storage, see here: (http://stackoverflow.com/questions/12555420/how-to-get-a-uri-object-from-bitmap) and I'd like to avoid that.