Android Question CameraEx error on Initialize2 function

Discussion in 'Android Questions' started by Juan Marrero, Jan 22, 2015.

  1. Juan Marrero

    Juan Marrero Active Member Licensed User

    Hi all, I'm getting an error trying to connect to cameras (front and rear). It doesn't matter which one i try to select the error is the same. I downloaded the CameraEx class and added to my app and copied the code from camera example to my app.

    Here is the error log:

    LogCat connected to: HT4AHWM01420
    --------- beginning of /dev/log/system


    --------- beginning of /dev/log/main


    Service ServiceRecord{43ac1a68 u0 com.estrongs.android.pop/com.estrongs.android.ui.notification.ESTaskService} in process ProcessRecord{41eeb320 4299:com.estrongs.android.pop/u0a250} not same as in map: null


    ** Activity (main) Create, isFirst = true **
    ** Activity (main) Resume **
    ** Activity (main) Pause, UserClosed = false **
    ** Activity (camera1) Create, isFirst = true **
    ** Activity (camera1) Resume **
    Error occurred on line: 32 (cameraexclass)
    java.lang.ClassCastException: android.widget.Button cannot be cast to android.view.SurfaceView
    at anywheresoftware.b4a.objects.CameraW.shared(CameraW.java:97)
    at anywheresoftware.b4a.objects.CameraW.Initialize2(CameraW.java:59)
    at prusb.cameroid.cameraexclass._initialize(cameraexclass.java:626)
    at prusb.cameroid.camera1._initializecamera(camera1.java:350)
    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:305)
    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:159)
    at prusb.cameroid.camera1.afterFirstLayout(camera1.java:104)
    at prusb.cameroid.camera1.access$100(camera1.java:16)
    at prusb.cameroid.camera1$WaitForLayout.run(camera1.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:157)
    at android.app.ActivityThread.main(ActivityThread.java:5872)
    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:852)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:668)
    at dalvik.system.NativeStart.main(Native Method)
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Don't add any view to the preview panel. You can put views above the panel but not as the panel's children.
     
  3. Juan Marrero

    Juan Marrero Active Member Licensed User

    And it was that simple!!! Thanks Erel!!!
     
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