我有以下 java 方法:
private Camera openFrontFacingCameraGingerbread() {
int cameraCount = 0;
Camera cam = null;
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
cameraCount = Camera.getNumberOfCameras();
for (int camIdx = 0; camIdx < cameraCount; camIdx++) {
Camera.getCameraInfo(camIdx, cameraInfo);
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
try {
cam = Camera.open(camIdx);
} catch (RuntimeException e) {
Toast.makeText(debug, "failed", Toast.LENGTH_LONG).show();
}
}
}
我期待做的就是在屏幕上镜像相机。这是,一旦我打开应用程序,我希望用户看到自己,但我无法完成此任务。
以下是同一类的onCreate方法:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
openFrontFacingCameraGingerbread();
}
有人可以帮我这个吗?非常感谢你