image - How to show taken picture after taking a picture in android using ImageView and avoid synchronicity problems -



image - How to show taken picture after taking a picture in android using ImageView and avoid synchronicity problems -

hello have application using surfaceviews , show preview image of image taken , button let's user retry taking picture. problem having method picturecallback anonymous function void can't homecoming file name or id let's me grab image , display overlaying surfaceview along retry button. know how can this? picturecallback() function here:( have edited original, instead of saving file saving global variable can access later through camerahelper object)

// global variable access bitmap when photographic camera callback has finished processing. private bitmappicture;

method takes picture:

public void takethepicture(camera mcamera) { log.d("camera information","taking image within takethepicture() method"); // image callback method required take image camera.picturecallback mpicture = new camera.picturecallback() { @override public void onpicturetaken(byte[] data, photographic camera camera) { // create bitmap image can later access through other way. bitmappicture = bitmapfactory.decodebytearray(data, 0, data.length); } }; mcamera.takepicture(null,null,mpicture); }

this way of accessing image has been working problem is, returning previous image took, there synchronicity problem time of access bitmappicture variable , time when info gets saved it.

hope can help me :) thanks!

it not possible because picturecallback asynchronous (and that's why void). may take hundreds of milliseconds capture picture.

the typical solution send message handler of activity, , allow handler show image view. means takepicture(camera) method can't static, have access parent activity or handler.

android image camera save surfaceview

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -