i want know how capture photo using camera api , save in camera folder or in gallery. please me sample code.
thanks monali
try out.. add in oncreate(), string img = getimagename(); call below method in oncreate() , should trick.
private void startcamera(string imagename) { intent cameraintent = new intent(mediastore.action_video_capture); cameraintent.putextra(android.provider.mediastore.extra_output, uri.fromfile(new file(imagename))); startactivityforresult(cameraintent, take_picture_with_camera); } private string getimagename() { string imgname = ""; string imgpath = ""; try { imgname = string.format("%d.png", system.currenttimemillis()); imgpath = strdirectoy + "/" + imgname; file file = new file(strdirectoy); boolean exists = file.exists(); if (!exists) { boolean success = (new file(strdirectoy)).mkdir(); if (success) log.e("directory created", "directory: " + strdirectoy + " created"); else log.e("directory creation","directory creation failed"); } } catch (exception e) { e.printstacktrace(); } return imgpath; }
Comments
Post a Comment