B4A Library [Class] CameraEx - Extends the camera library functionality

Discussion in 'Additional libraries, classes and official updates' started by Erel, Nov 28, 2012.

Thread Status:
Not open for further replies.
  1. Erel

    Erel Administrator Staff Member Licensed User

    Check the unfiltered logs. There might include more information.
     
    ali.hassanabadi likes this.
  2. cooperlegend

    cooperlegend Active Member Licensed User

    where are these?
     
  3. cooperlegend

    cooperlegend Active Member Licensed User

    No more information after unticking the filtered flag....

    I have tried every camera setup option i can think off.

    It always crashes... YET it does actually take the picture and save it.

    might just have to put a catch around this code until the routine is fixed.




    LogCat connected to: B4A-Bridge: samsung SM-T710
    --------- beginning of main
    ** Activity (main) Create, isFirst = true **
    ** Activity (main) Resume **
    ** Service (service1) Create **
    ** Service (service1) Start **
    Connected to B4A-Bridge (Wifi)
    Installing file.
    ** Activity (main) Pause, UserClosed = false **
    PackageAdded: package:the59club.sapphire
    --------- beginning of system
    ** Activity (main) Resume **
    ** Activity (main) Pause, UserClosed = false **
    ** Service (starter) Create **
    ** Service (starter) Start **
    ** Activity (main) Create, isFirst = true **
    ** Activity (main) Resume **
    ** Activity (main) Pause, UserClosed = true **
    ** Activity (frmsection) Create, isFirst = true **
    (BALayout): Layout not available
    ExecuteMemoryTable: SELECT name, id FROM sections WHERE app = 1 ORDER By id
    ** Activity (frmsection) Resume **
    ** Activity (frmsection) Pause, UserClosed = true **
    ** Activity (frmquestion) Create, isFirst = true **
    (BALayout): Layout not available
    ExecuteMemoryTable: SELECT id, question, help, qorder, multiplechoice, scored, '1' AS addquestion FROM testquestionsadd WHERE (venue_id = 175 OR venue_id = 0) AND section = 6 AND (subsection = 0 OR subsection = 0) ORDER By qorder
    ExecuteMemoryTable: SELECT id, question, help, qorder, multiplechoice, scored, '0' AS addquestion FROM testquestions WHERE section = 6 AND (subsection = 0 OR subsection = 0) ORDER By tester_qorder
    ** Activity (frmquestion) Resume **
    ** Activity (frmquestion) Pause, UserClosed = true **
    ** Activity (frmtest) Create, isFirst = true **
    (BALayout): Layout not available
    (BALayout): Layout not available
    ** Activity (frmtest) Resume **
    90
    [Height=1080, IsInitialized=false, Width=1920
    ]
    Error occurred on line: 101 (CameraExClass)
    java.lang.RuntimeException: takePicture failed
    at android.hardware.Camera.native_takePicture(Native Method)
    at android.hardware.Camera.takePicture(Camera.java:1484)
    at android.hardware.Camera.takePicture(Camera.java:1429)
    at anywheresoftware.b4a.objects.CameraW.TakePicture(CameraW.java:287)
    at the59club.sapphire.cameraexclass._takepicture(cameraexclass.java:330)
    at the59club.sapphire.frmtest._pnlcamera_touch(frmtest.java:1065)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.BA$1.run(BA.java:293)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:6145)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
    Error occurred on line: 101 (CameraExClass)
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference
    at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:455)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:282)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.BA$1.run(BA.java:293)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:6145)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
    ** Activity (main) Resume **
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    As I previously wrote it fails in the native layer. The only possible way to fix it is to update the device or install a different ROM.
     
    ali.hassanabadi likes this.
  5. wizard699

    wizard699 Active Member Licensed User

    ERROR JAVA line 618 in takePicture.

    Hi Erel.
    On some smartphone HTC and Samsung, CameraEx show this error immediatly after Picture preview.
    I've this picture captured.
    How resolve?
     

    Attached Files:

    Last edited: Feb 4, 2016
  6. Erel

    Erel Administrator Staff Member Licensed User

    You need to check the logs and see whether there is more information.

    The error message itself means that the camera failed to take a picture. Maybe the settings were misconfigured.
     
    ali.hassanabadi likes this.
  7. Cableguy

    Cableguy Expert Licensed User

    About the auto focus, the simple retrieving of the focus modes do NOT ensure that all are implemented in the hardware... Proof of that is my device, Lenny2 from wiko.
    I have "auto" listed as supported, though I KNOW the device is fixed focus... So I tried to set the auto focus, and in the focus done event, I got an exception!
    So be aware, device supported modes may not comply with the hardware!
     
    ali.hassanabadi likes this.
  8. wizard699

    wizard699 Active Member Licensed User

    Unfortunately, the error occurs only on a couple of smartphones , compared to 100 installed .
    I do not have the ability to do debugging on these phones . Are reports and pictures from the outside joints . The image appears ... but after a while you get the error .
     
    ali.hassanabadi likes this.
  9. Baris Karadeniz

    Baris Karadeniz Active Member Licensed User

    "camEx.Release" line written at the Sub Activity_Pause gives an error when the app is closed when the camera is open. How can I solve this? My codes are;

    Code:
    Sub Activity_Pause (UserClosed As Boolean)
        camEx.Release  <------ LINE 
    451
    End Sub
    And the error is;

    Installing file.
    PackageAdded: package:app.taksim.driver
    ** Activity (main) Create, isFirst = true **
    ** Activity (main) Resume **
    90
    [Height=720, IsInitialized=false, Width=960
    ]
    ** Activity (main) Pause, UserClosed = false **
    ** Activity (main) Create, isFirst = false **
    ** Activity (main) Resume **
    0
    [Height=720, IsInitialized=false, Width=960
    ]
    ** Activity (main) Pause, UserClosed = false **
    ** Activity (main) Create, isFirst = false **
    ** Activity (main) Resume **
    ** Activity (main) Pause, UserClosed = false **
    Error occurred on line: 451 (Main)
    java.lang.RuntimeException: Class instance was not initialized (cameraexclass)
    at anywheresoftware.b4a.debug.Debug.shouldDelegate(Debug.java:249)
    at app.taksim.driver.cameraexclass._release(cameraexclass.java:72)
    at app.taksim.driver.main._activity_pause(main.java:754)
    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:702)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at app.taksim.driver.main.onPause(main.java:262)
    at android.app.Activity.performPause(Activity.java:5555)
    at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1239)
    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3364)
    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3333)
    at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3311)
    at android.app.ActivityThread.access$1100(ActivityThread.java:175)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1319)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5602)
    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:1283)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    at dalvik.system.NativeStart.main(Native Method)
     
  10. DonManfred

    DonManfred Expert Licensed User

    you forgot to initialize the class on activty_create?

    You cant release a instance in acitivity pause if the class is not initialized.
     
  11. Baris Karadeniz

    Baris Karadeniz Active Member Licensed User

    I initialized camera in the sub, because camera will not be displayed in the main panel. It will be displayed in another panel called as PanelCamera. What should I do in this case?

    Code:
    Sub BtnCamera_Click
        PanelMain.Visible = 
    False
        PanelCamera.Visible = 
    True
        InitializeCamera
    End Sub
     
  12. DonManfred

    DonManfred Expert Licensed User

    only release if you initialized before. Not if not.
     
  13. Baris Karadeniz

    Baris Karadeniz Active Member Licensed User

    I tried to release it in anywhere else seen at the codes below related to the CameraPanel but when I open CameraPanel, camera shows meaningless view. If I release it in pause sub, camera works but it gives error which I gave above when the app is closed if the camera is open. I need to find another solution. May be release it in both 2 places?

    Code:
    Sub BtnCamera_Click
        PanelMain.Visible = 
    False
        PanelCamera.Visible = 
    True
        InitializeCamera
    End Sub

    Sub BtnCameraBack_Click
        camEx.Release
        PanelCamera.Visible = 
    False
        PanelMain.Visible = 
    True
    End Sub
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    You should start a new thread in the questions forum and explain the changes that you made. We cannot guess which changes you made to the original example.
     
  15. Declan

    Declan Active Member Licensed User

    I am using the example in the first post.
    How can I set the following parameters in code:
    Flash Mode
    Picture Size.
    I would like the picture to always be 320x240
    The Flash will always be ON, if available
    I will use the "Focus + TP" for the taking of picture instead of the "Take Picture"
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    With:
    CamEx.SetFlashMode and CamEx.SetPictureSize.
     
  17. Declan

    Declan Active Member Licensed User

    Would this be the correct syntax:
    Code:
    camEx.SetFlashMode("on")
        camEx.SetPictureSize(
    320240)
    Would this code be placed in:
    Sub Activity_Create(FirstTime As Boolean)
     
  18. Declan

    Declan Active Member Licensed User

    G
    Got it
     
    Daniel-White likes this.
  19. Erel

    Erel Administrator Staff Member Licensed User

    CameraEx v1.30 is now available from the first post.
     
    Johan Schoeman and Declan like this.
  20. Declan

    Declan Active Member Licensed User

    Cool, works great
     
Thread Status:
Not open for further replies.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice