java - Android application: how to use the camera and grab the image bytes? -
java - Android application: how to use the camera and grab the image bytes? -
i'm trying create little app android takes image using device's photographic camera , put's png frame on top of it. way final saved image have beach on top of it, or hats, or anything. have sample programs behavior?
have @ sdk documentation on using image capture intent here.
i start image capture intent this:
intent intent = new intent(mediastore.action_image_capture); startactivityforresult(intent, capture_image_activity_request_code);
capture_image_activity_request_code private fellow member in activity:
private static final int capture_image_activity_request_code = 100;
then byte array photographic camera using next onactivityresult handler:
@override public void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == capture_image_activity_request_code) { if (resultcode == activity.result_ok) { bitmap bmp = (bitmap) data.getextras().get("data"); bytearrayoutputstream stream = new bytearrayoutputstream(); bmp.compress(bitmap.compressformat.png, 100, stream); byte[] bytearray = stream.tobytearray(); addimage(bytearray); } else if (resultcode == activity.result_canceled) { // user cancelled image capture } else { // image capture failed, advise user } } }
after can processing want on image.
java android mobile titanium
Comments
Post a Comment