本文介绍了如何拍照从Android2.2的前置摄像头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人可以告诉如何拍照的前置摄像头,在Android2.2的任何人可以提供样品code

can anybody tell How to take picture from front camera in android2.2 can anybody provide sample code

感谢

推荐答案

您应该使用与正确的相机指数照相机API:

You should use the Camera API with the right camera index:

Camera camera = Camera.open();
Camera.Parameters parameters = camera .getParameters();
parameters.set("camera-id", 2);
camera .setParameters(parameters);

不要忘了正确设置权限:

Don't forget to set the permissions correctly:

<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.CAMERA" />

请注意,在大多数情况下,这将是相机#2,也许还有另外找出自动方式。
你试试这一个了。如果我会找到一些自动我会更新帖子。

Please note that in most cases it will be camera #2, maybe there is another automatic way to find out.You try this one for now. If I'll find something automatic I'll update the post.

和你可以从这里完整的code(只需更换Camera.open):

And you can take the complete code from here (just replace the Camera.open):Camera Tutorial

这篇关于如何拍照从Android2.2的前置摄像头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 05:40