Android Question Which Camera library

nibbo

Active Member
Licensed User
Longtime User
Which cameral library / classes are the latest and most supported?
There seem to be two camera and camera Ex...
Thanks
 

Cableguy

Expert
Licensed User
Longtime User
Camera Ex extends the basic Camera functions, maquing it a bit more easy to use.
Camera is a library, camera Ex is a class, that depends on the camera lib as well as two others (reflection and another I can't remember)
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
Camera Ex extends the basic Camera functions, maquing it a bit more easy to use.
Camera is a library, camera Ex is a class, that depends on the camera lib as well as two others (reflection and another I can't remember)

Thanks cableguy. I tried the camera library on it's own which errors so I added the cameraEx class and that fails also.
I have the camera, core and reflection libraries in my poject.
I downloaded a working project and can run it but mine crashes with

cameraexclass_initialize (java line: 409)
java.lang.NullPointerException
at anywheresoftware.b4a.objects.CameraW.shared(CameraW.java:70)
at anywheresoftware.b4a.objects.CameraW.Initialize2(CameraW.java:59)
at xxx.xxx.cameraexclass._initialize(cameraexclass.java:409)
at xxx.xxx.main._activity_create(main.java:474)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at xxx.xxx.main.afterFirstLayout(main.java:102)
at xxx.xxx.main.access$000(main.java:17)
at xxx.xxx.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5653)
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:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Activity (main) Pause, UserClosed = false **

The line of code it fails on is in the Initialize sub in the cameraEx class
B4X:
cam.Initialize2(Panel1, "camera", id)

Do I need to change the manifest or anything to allow permissions for the camera...?
Thanks
 
Last edited:
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
Unfortunately you don't give enouch information.
What error do you get ?
Do you check the libraries in the Lib Tab ?
Do you dim cam before initializing it ?

Thanks Klaus.

Did not really get an error message other than the null pointer shown above.
However I did swap things around a bit and it is now working.
I added the panel with the designer rather than in code and now it is working OK.
Not sure why.... buy hey it works so all good.

Thanks for the replies.
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
OK, in case anyone else comes across this issue.
I found the problem to be when you have other views/controls on the panel that the camera was initialized with.
In my case I had a button that the user could 'click' to take a picture. Move this to the main activity and all OK again...
 
Upvote 0
Top