Android - Get URI from Picture that i just have taken (without save the image again) -


i've found lot of answers questions mine doesn't make sense me. let me explain.

i have imagebutton let user take picture , display on interface. when try image uri, returns null:

uri uri = data.getdata();  

i've made searches on internet , found solutions like:

@override public void onactivityresult(int requestcode, int resultcode,         intent data) {     try {         if (resultcode == activity.result_ok) {             updateprofilepicure = boolean.true;             switch(requestcode){                 case 0:                     bundle extras = data.getextras();                     object xx = data.getdata();                     bitmap imagebitmap = (bitmap) extras.get("data");                     uri tempuri = getimageuri(imagebitmap);                     imageview.setimagebitmap(imagebitmap);                     break;                 default: break;             }         }     } catch(exception e){         e.printstacktrace();     } }  public uri getimageuri(bitmap inimage) {     bytearrayoutputstream bytes = new bytearrayoutputstream();     inimage.compress(bitmap.compressformat.jpeg, 100, bytes);     string path = mediastore.images.media.insertimage(             applicationcontext.getinstance().getcontext().getcontentresolver(), inimage,    "title", null);     return uri.parse(path); }    

for me, doesn't make sense because when call goes method onactivityresult(), picture saved on dcim folder , don't have reason save again. why should use it?

is possible find way retrieve uri captured image?

thank's in advance.

the picture saved on dcim folder , don't have reason save again.

not necessarily. quoting the documentation action_image_capture:

the caller may pass extra_output control image written. if extra_output not present, small sized image returned bitmap object in field.

(the "extra field" here keyed data)

the code snippet pasted retrieving data extra, , image not stored anywhere.

is possible find way retrieve uri captured image?

you have code this, in first code snippet -- if specifying uri extra_output in action_image_capture request, uri image taken in intent handed onactivityresult().


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -