我想创造一些像上面,有三个框,就会像一个摄像头预览。 怎样做任何想法或概念?
我试图让相机的实例,并将其放置到三个camerapreview的对象,但我得到一个错误信息,我想,这是不允许的。 这里是我的代码:
private CameraPreview mPreview;
private CameraPreview mPreview2;
private CameraPreview mPreview3;
private FrameLayout preview;
private FrameLayout preview2;
private FrameLayout preview3;
mCamera=getCameraInstance();
mCamera2=getCameraInstance();
mCamera3=getCameraInstance();
mPreview=new CameraPreview(getApplicationContext(), mCamera);
mPreview2=new CameraPreview(getApplicationContext(), mCamera2);
mPreview3=new CameraPreview(getApplicationContext(), mCamera3);
preview=(FrameLayout)findViewById(R.id.camSetA_qr1);
preview.addView(mPreview);
preview2=(FrameLayout)findViewById(R.id.camSetA_qr1);
preview2.addView(mPreview2);
preview3=(FrameLayout)findViewById(R.id.camSetA_qr1);
preview3.addView(mPreview3);
和我的getInstance代码
public static Camera getCameraInstance() {
Camera c = null;
try {
c = Camera.open();
} catch (Exception e) {
}
return c;
}