简体   繁体   English

如何在新意图中选择“前置摄像头”?

[英]How to choose “front camera” on new intent?

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra("android.intent.extras.CAMERA_FACING", 1);

    startActivityForResult(intent, CAMERA_REQUEST);

My code is this above, my device is LG Nexus 4 with 4.4.2. 我的代码如上所述,我的设备是带有4.4.2的LG Nexus 4。

Intent starts with back camera always. Intent始终以后置摄像头开始。 I try to change number with 0,1,2 but same result. 我尝试用0,1,2更改数字,但结果相同。 how can i do? 我能怎么做?

Thanks 谢谢

Officially, there's no intent that targets the front-facing camera. 正式来说,没有针对前置摄像头的意图。 Your code might work on some phones, though. 但是,您的代码可能适用于某些手机。 See here for more details 有关详细信息,请参见此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM