连接一上的 Camera.setParameters() 上的 RuntimeException [英] RuntimeException on Camera.setParameters() on nexus one
问题描述
我从 这里的答案复制了代码,我仍然得到一个 RuntimeException: setParameters failed 错误在我的关系之一.我的清单文件具有相机和唤醒锁定权限.这适用于模拟器,在 droid 上我没有收到错误,但它确实存在旋转问题.
I copied the code from the answer here and I still am getting a RuntimeException: setParameters failed error on my nexus one. My manifest file has camera and wake_lock permissions. This works on the emulator, and on the droid I don't get the error but it does have a rotation problem.
推荐答案
您很可能请求的预览尺寸无效.如果您检查 adb logcat
的结果,您可能会看到如下内容:
You're most likely requsting an invalid preview size. If you check the results of adb logcat
you'll probably see something like this:
E/QualcommCameraHardware(22732): Invalid preview size requested: 480x724
解决方案是请求与您想要的最接近的可用预览尺寸;您可以通过在 getSupportedPreviewSizes 来获取可用预览尺寸的列表Camera 返回的 "noreferrer">Camera.Parameters 对象.getParameters.
The solution is to request the closest available preview size to the one you'd like; you can get a list of available preview sizes by calling getSupportedPreviewSizes
in the Camera.Parameters object returned by Camera.getParameters.
这篇关于连接一上的 Camera.setParameters() 上的 RuntimeException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!