in kernel, android framework, I apply that adv7180 patch.
and the test program is simple:
=================================================
package test.camerapreview;
import java.io.IOException;
import android.util.Log;
import android.app.Activity;
import android.os.Bundle;
import android.hardware.Camera;
import android.view.SurfaceView;
import android.view.SurfaceHolder;
import android.content.Context;
class Preview extends SurfaceView implements SurfaceHolder.Callback {
SurfaceHolder mHolder;
Camera mCamera;
Preview(Context context) {
super(context);
mHolder = getHolder();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
public void surfaceCreated(SurfaceHolder holder) {
mCamera = Camera.open();
try {
mCamera.setPreviewDisplay(holder);
} catch (IOException e) {
e.printStackTrace();
}
}
public void surfaceDestroyed(SurfaceHolder holder) {
mCamera.stopPreview();
mCamera.release();
mCamera = null;
mHolder = null;
}
public void surfaceChanged(SurfaceHolder holder,int format,int w,int h){
Camera.Parameters parameters = mCamera.getParameters();
parameters.setPreviewSize(720,480);
mCamera.setParameters(parameters);
mCamera.startPreview();
}
}
and layout:
============================================
<?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"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>