probably u can click a picture and call like this,

preview.camera.takePicture(shutterCallback, rawCallback,
jpegCallback); in the onPreviewFrame()..
registering with callBacks shutterCallback,rawCallback,,jpegCallback.

for eq.

ShutterCallback shutterCallback = new ShutterCallback() {
                public void onShutter() {
                        Log.d(TAG, "onShutter'd");
                }
        };

        /** Handles data for raw picture */
        PictureCallback rawCallback = new PictureCallback() {
                public void onPictureTaken(byte[] data, Camera camera) {
                        Log.d(TAG, "onPictureTaken - raw");
                }
        };

        /** Handles data for jpeg picture */
        PictureCallback jpegCallback = new PictureCallback() {
                public void onPictureTaken(byte[] data, Camera camera) {
                        FileOutputStream outStream = null;
                        try {
                                // write to local sandbox file system
//                              outStream =
CameraDemo.this.openFileOutput(String.format("%d.jpg",
System.currentTimeMillis()), 0);
                                // Or write to sdcard
                                outStream = new 
FileOutputStream(String.format("/sdcard/%d.jpg",
System.currentTimeMillis()));
                                outStream.write(data);
                                outStream.close();
                                Log.d(TAG, "onPictureTaken - wrote bytes: " + 
data.length);
                        } catch (FileNotFoundException e) {
                                e.printStackTrace();
                        } catch (IOException e) {
                                e.printStackTrace();
                        } finally {
                        }
                        Log.d(TAG, "onPictureTaken - jpeg");
                }
        };



On Mar 22, 12:33 pm, bright wang <[email protected]> wrote:
> the Code Snippet following :
>
> mCamera =Camera.open();
>
> mCamera.setPreviewCallback(mPreviewCallback);
>
> Camera.PreviewCallback mPreviewCallback = newCamera.PreviewCallback()
> {
>
>                 @Override
>                 public void onPreviewFrame(byte[] data,Cameracamera) {
>                                 Log.d(TAG, "onPreviewFrame! data is " + (data 
> == null ? "null!" :
> "ok!"));
>
>                                 Here, i want to convert data to image/
> bitmap, how to do ?
>
>                                 }
>                         }
>                 }
>
>         };
> --
> Best Regards!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to