Ich möchte dieses Thema nochmal aufgreifen und eine Frage stellen.
Ich habe den folgenden Code und möchte nun Fotoserien schießen. Leider bekomme ich es nicht hin das ganze i-wie als Schleife laufen zu lassen.
Vielleicht kann jemand helfen?
public class MyCamera extends Activity {
private Camera _camera;
private String TAG = "MyCamera";
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate()");
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(new CameraPreview(this));
}
private Camera.PreviewCallback mPreviewListener = new Camera.PreviewCallback() {
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
Log.d(TAG, "onPreviewFrame()");
//Speichern
}
};
@Override
public boolean onTouchEvent(MotionEvent event) {
Log.d(TAG, "onTouchEvent()");
if (event.getAction() == MotionEvent.ACTION_DOWN) {
//Schleife?
_camera.setOneShotPreviewCallback(mPreviewListener);
}
return super.onTouchEvent(event);
}
public void setCameraDisplayOrientation(android.hardware.Camera camera, int cameraId) {
}
public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
private SurfaceHolder holder;
CameraPreview(Context context) {
super(context);
holder = getHolder();
holder.addCallback(this);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
configure( format, width, height) ;
}
public void surfaceDestroyed(SurfaceHolder holder) {
}
public void surfaceCreated(SurfaceHolder holder) {
}
protected void setPictureFormat(int format) {
}
protected void setPreviewSize(int width, int height) {
}
public void configure(int format, int width, int height) {
}
}
}
Alles anzeigen