Android Default camera capture image return image URI null -


i opening default camera app capture image in application not getting captured image uri. below code -

code open camera -

    inittmpuris();     intent intent = new intent(mediastore.action_image_capture);     intent.putextra(mediastore.extra_output, capturedimageuri);     intent.putextra("return-data", true); 

code create image path store -

private void inittmpuris() {     file proejctdirectory = new file(camerautil.folder_path + file.separator + camerautil.folder_name);     if (!proejctdirectory.exists()) {         proejctdirectory.mkdir();     }     file tempdirectory = new file(proejctdirectory, "temp");     if (!tempdirectory.exists()) {         tempdirectory.mkdir();     } else {         // delete old files         (file file : tempdirectory.listfiles()) {             if (file.getname().startswith("tmp_")                     || file.getname().startswith("croped_")) {             }         }      }     capturedimageuri = uri.fromfile(new file(tempdirectory, "tmp_"             + string.valueof(system.currenttimemillis()) + ".jpg"));      file extraoutputfile = new file(tempdirectory, "croped_"             + string.valueof(system.currenttimemillis()) + ".jpg");      extraoutputfile.setwritable(true);     cropimageuri = uri.fromfile(extraoutputfile); } 

and code in onactivityresult -

 case req_code_pick_from_camera_without_crop: {              if (resultcode == result_ok) {                 if(null!=capturedimageuri) {                     string imagepath = capturedimageuri.getpath();                     file file = new file(imagepath);                     onsingleimageselected(reqcodestarter, file, imagepath,                             get_picture_bitmap(file));                 }               } else {                 onmediapickcanceled(reqcodestarter,                         req_code_pick_from_camera_without_crop);             }          }         break; 

i getting capturedimageuri in samsung s7 device, in other devices return url of captured image.

add code activity tag inside manifest file.

 android:configchanges="orientation|keyboardhidden|screensize" 

it not let current activity destory , re-create result.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -