我想在nexus 7中打开前置摄像头但是我不打开它总是打开后置摄像头然后手动我通过我的android程序选择前置摄像头我怎么能先打开前置摄像头我先试过{{ 3}}但不适合我。
@present我使用下面的代码打开相机并拍摄图像
button2.setOnClickListener(new View.OnClickListener() {
private static final int IMAGE_CAPTURE = 102;
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra ("camerasensortype", 2);
startActivityForResult(intent, IMAGE_CAPTURE);
}
答案 0 :(得分:4)
你去:) 使用5X(7.0),MI3(6.0),S3 Neo(4.4)
Intent launchIntent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
launchIntent.putExtra("android.intent.extras.CAMERA_FACING", android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
launchIntent.putExtra("android.intent.extras.LENS_FACING_FRONT", 1);
launchIntent.putExtra("android.intent.extra.USE_FRONT_CAMERA", true);
startActivity(launchIntent);
答案 1 :(得分:0)
cameraIntent.putExtra("android.intent.extras.CAMERA_FACING", 1);