camera - How to take pictures in android application without the user Interface..? -
i have design application, application has take picture camera without displaying in layout , without user interface (like click of button....) , store picture?
camera mcamera; private boolean safecameraopen(int id) { boolean qopened = false; try { releasecamera(); mcamera = camera.open(id); qopened = (mcamera != null); } catch (exception e) { log.e(getstring(r.string.app_name), "failed open camera"); e.printstacktrace(); } return qopened; } private void releasecamera() { if (mcamera != null) { mcamera.release(); mcamera = null; } } //somewhere in code call this: mcamera.takepicture(null, null, mcall); camera.picturecallback mcall = new camera.picturecallback() { public void onpicturetaken(byte[] data, camera camera) { //decode data obtained camera bitmap fileoutputstream outstream = null; try { outstream = new fileoutputstream("/sdcard/image.jpg"); outstream.write(data); outstream.close(); } catch (filenotfoundexception e){ log.d("camera", e.getmessage()); } catch (ioexception e){ log.d("camera", e.getmessage()); } } };
Comments
Post a Comment