Android Question [Q] Advanced Camera Library issues with setting parameters.

Tyler

Member
Licensed User
Longtime User
Hi, every time I attempt to change a parameter with ACL(such as max fps range, front or back cam, etc.), It returns a bunch of errors.



Code:
java.lang.RuntimeException: Fail to connect to camera service
    at android.hardware.Camera.native_setup(Native Method)
    at android.hardware.Camera.<init>(Camera.java:373)
    at android.hardware.Camera.open(Camera.java:328)

ETC................................



Any help with this would be greatly appreciated, I'm having a rather tough time with ACL.
 
Have you tried to use CameraEx?

Didn't realize reflector was its own library. Now I'm stuck on setting and getting parameters, where can I find a list of keys for each parameter? Or are they just the ones in the format of
PREVIEW_FPS_MAX_INDEX. ?



Code:
cam.GetParameter("PREVIEW_FPS_MAX_INDEX")

OR

cam.SetFocusMode("fixed")
cam.CommitParameters

OR

cam.SetParameter("ANTIBANDING_AUTO", "auto")
cam.CommitParameters

This as well as a few others return this error as well as others that are similar:

Code:
(Exception) java.lang.Exception:  java.lang.RuntimeException: setParameters failed
Error occurred on line: 142 (cameraex)
java.lang.RuntimeException: setParameters failed
    at android.hardware.Camera.native_setParameters(Native Method)
    at android.hardware.Camera.setParameters(Camera.java:1695)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    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.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:519)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:235)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:161)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:66)
    at android.view.View.performClick(View.java:4445)
    at android.view.View$PerformClick.run(View.java:18446)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5144)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
    at dalvik.system.NativeStart.main(Native Method)
(Exception) java.lang.Exception:  java.lang.RuntimeException: setParameters failed
** Activity (main) Pause, UserClosed = true **



Lastly, I'd like to get the max FPS range but I'm not sure how to do that with CameraEX Class.

And Also, I'm having an issue where I do activity.RemoveAllViews, activity.LoadLayout("cam") to effectively reload everything, but the 3 buttons I have in "cam" show but don't work :S



Sorry for such an un-organised post:(
 
Last edited:
Upvote 0
And Also, I'm having an issue where I do activity.RemoveAllViews, activity.LoadLayout("cam") to effectively reload everything, but the 3 buttons I have in "cam" show but don't work :S
Have you tried the CameraEx example? You don't need to do anything special to "reload everything".

Use GetSupportedPreviewFpsRange to find the supported values. Same is true for focus: GetSupportedFocusModes.
 
Upvote 0
Would you be able to provide some examples of setting the fps range and also of using .SetParameter? To much surprise, Google searches aren't turning up what I need. Also, does CamEx support changing the antibanding? There's also no SetFocusMode( I think it was focus, I can't check at the moment.), only SetColorMode and one other if memory serves.


Thanks again for helping me out:)
 
Upvote 0
Back
Top