Android:检查相机是否支持自动对焦? [英] Android: Check whether camera supports auto-focus?

查看:25
本文介绍了Android:检查相机是否支持自动对焦?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 Android API 2.1 及更高版本,我们可以使用上下文:

For the Android API version 2.1 and higher, we can use context:

getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_AUTOFOCUS)

但在 2.1 版本之前,我们如何执行相同的操作呢?有没有这样的事情不涉及调用 Camera.open 然后 getParameters?

But before version 2.1, how can we perform the same operation? Is there anything like this that does not involve invoking Camera.open and then getParameters?

推荐答案

List<String> supportedFocusModes = camera.getParameters().getSupportedFocusModes();
boolean hasAutoFocus = supportedFocusModes != null && supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)

这篇关于Android:检查相机是否支持自动对焦?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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