Public Sub IsZoomSupported As Boolean
r.target = parameters
Return r.RunMethod("isZoomSupported")
End Sub
Public Sub GetMaxZoom As Int
r.target = parameters
Return r.RunMethod("getMaxZoom")
End Sub
Public Sub SetZoom(Zoom As Int)
r.target = parameters
r.RunMethod2("setZoom", Zoom, "java.lang.int")
End Sub
Note that it is better to start a new thread for a new question.
You can use this code:
B4X:
Public Sub GetFocusDistances As Float()
Dim f(3) As Float
r.Target = parameters
r.RunMethod4("getFocusDistances", Array As Object(f), Array As String("[F"))
Return f
End Sub
'call it
Dim f() As Float = camEx.GetFocusDistances
Log(f(0) & ", " & f(1) & ", " & f(2))
Hi cluster1,
are you looking for a way to start zooming on a button click? If yes, please find below some example code based on your own and what it is in post #2
B4X:
Sub btnZoomin_Click
if CamEx.IsZoomSuported then
dim maxZ as int
maxZ = CamEx.GetMaxZoom
CamEx.SetZoom(maxZ)
else
ToastMessageShow("Sorry, unable to zoom",True)
end if
End Sub
I use the ZOOM method to do zoom in/out , but the scene of camera not becoming larger or smaller.
Who can provides the camera zooming example for me, thanks.
Yes, I can use the zooming control, but when I execute the FocusAndTakePicture method, then the procedure will break and throw the exception error about autofocus
I think that is the java error when I use the cameraExclass
Public Sub FocusAndTakePicture
cam.AutoFocus
End Sub
** Activity (main) Pause, UserClosed = true **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Error occurred on line: 316 (cameraexclass)
java.lang.NullPointerException
at anywheresoftware.b4a.objects.CameraW.AutoFocus(CameraW.java:191)
at Insert.water.gov.cameraexclass._focusandtakepicture(cameraexclass.java:534)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:302)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:158)
at Insert.water.gov.main.afterFirstLayout(main.java:104)
at Insert.water.gov.main.access$100(main.java:16)
at Insert.water.gov.main$WaitForLayout.run(main.java:76)
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:5050)
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:780)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:596)
at dalvik.system.NativeStart.main(Native Method)