Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RuntimeException on Camera.setParameters() on nexus one

Tags:

android

camera

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.

like image 738
Erik B Avatar asked Jan 12 '10 03:01

Erik B


1 Answers

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 

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.

like image 128
Roman Nurik Avatar answered Oct 08 '22 22:10

Roman Nurik