Android Question CameraEx class zoom function no work in portrait mode

Cebuvi

Active Member
Licensed User
Longtime User
Hello
I added the CameraEx class in an app with a seekbar to control the zoom. With the screen in lanscape mode it works correctly, but in portrait mode the following error occurs.

Error occurred on line: 144 (CameraExClass)
java.lang.RuntimeException: setParameters failed
at android.hardware.Camera.native_setParameters(Native Method)
at android.hardware.Camera.setParameters(Camera.java:1898)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.agraham.reflection.Reflection.runmethod(Reflection.java:216)
at anywheresoftware.b4a.agraham.reflection.Reflection.RunMethod4(Reflection.java:857)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:778)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:358)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA$1.run(BA.java:330)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

The error occurs in the instruction:

B4X:
camEx.CommitParameters

Any ideas to solve it?

Thank you
 

JordiCP

Expert
Licensed User
Longtime User
Perhaps the zoom parameter has gone out-of-bounds and it is not allowed by the Camera object.
Try to log the parameters that you are setting (not only the zoom) just before the call to camEx.CommitParameters
 
Upvote 0
Top