如何获取cameraID并使用setTorchMode? [英] How does one retrieve the cameraID and use setTorchMode?

查看:1255
本文介绍了如何获取cameraID并使用setTorchMode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,Android M最近问世了,它现在具有称为setTorchMode的内置摄像功能.我很好奇这是如何作为参数工作的(字符串cameraID,布尔值true/false).布尔值显然指示了灯光是打开还是关闭,但是如何获取cameraID?我知道有一个名为getCameraIDList的方法,但是它返回一个ID数组,而不仅仅是一个ID数组.您怎么知道要使用该列表中的哪一个?

So Android M recently came out and it now has a built in cameralight function called setTorchMode. I was curious as to how this worked as the parameters are (String cameraID, Boolean true/false). The Boolean obviously dictates whether the light is on or off, but how do you get the cameraID? I know there's a method called getCameraIDList, but that returns an array of IDs, not just one. How do you know which one in that list to use?

推荐答案

您应该使用CameraManager的"getCameraIdList"函数,该函数将为您检索一个字符串列表,每个字符串代表一个活动的摄像机.

You should use CameraManager "getCameraIdList" function which will retrieve you a list of strings where each represent an active camera.

这篇关于如何获取cameraID并使用setTorchMode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆