Android: Camera opens but doesn't save the taken shot, why? -
i trying take picture , save in gallary app. far managed write following piece of code:
public void sendmessages(view view) { intent intent = new intent(this, messagingadapter.class); startactivity(intent); } public void takepicture(view view) { intent cameraintent = new intent(mediastore.action_image_capture); cameraintent.putextra(mediastore.extra_output, getimageuri()); startactivityforresult(cameraintent, take_photo_code); } public uri getimageuri() { picno++; string storagefolderpath = environment.getexternalstoragedirectory() + "/cameraimages/"; string fullfilename = storagefolderpath + picno + ".jpg"; file newpic = new file(fullfilename); uri outputfileuri = uri.fromfile(newpic); return outputfileuri; } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { if (resultcode == 1) return; if (requestcode == 3) { uri uri = data.getdata(); //you data here } }
it working , there no error. however, doesn't function want.
i testing on nexus-7 (cynongemode) . app opens camera alright. after taking shot, freezes on taken image , gives 3 options (the camera app built-in app):
- cancel , return camera app, or
- retake shot, or
- accept taken image !
now, first 2 options work 3rd option doesn't @ all, freezes shown bellow:
what might problem , why canoot save image ?!
update
i put simple onactivityresult
method. doesn't go there (when debugging). however, when remove cameraintent.putextra
line, goes onactivityresult
again no saved image !!.
did put permissions manifest.xml
?
<uses-permission android:name="android.permission.write_external_storage" />
Comments
Post a Comment