Photo Capture Display contd

camera.xml

ImageCaptureActivity: preview setup public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {

Log.e(getClass().getSimpleName(), "surfaceChanged"); if (isPreviewRunning) { camera.stopPreview();

camera.setPreviewDisplay(holder); camera.startPreview();

isPreviewRunning = true; }

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android"

android:orientation="vertical" android:layout_width="fill_parent"

android:layout_height="fill_parent" android:background="@drawable/bg"> <SurfaceView android:id="@+id/surface"

android:layout_width="fill_parent" android:layout_height="10dip"

android:layout_weight="1">

</SurfaceView>

</LinearLayout>

photo capture public void onPreviewFrame(byte[] data, Camera c) {

Log.i(getClass().getSimpleName(), "preview frame RAW: " + data);

Camera.Parameters params = c.getParameters(); params.setPictureFormat(PixelFormat.JPEG); params.setPictureSize(PHOTO_WIDTH,PHOTO_HEIGHT); c.setParameters(params);

sizeSet = true;

0 0

Post a comment