camera problem

fifiddu70

Well-Known Member
Licensed User
Longtime User
hi , i have a problem with an application with camera, in debug its ok, in release i have a this problem: an error has occured in sub:main_camera1_ready(java line: 470)java.lang.nullpointerexception.
post a part of my application.
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("camera")
   p.SetScreenOrientation(0)
   camera1.Release
   adview1.Initialize("AdView1","a150b2569628e76")
    Activity.AddView(adview1, (Activity.Width - 320dip) / 2, Activity.Height - 50dip, 320dip, 50dip)
   adview1.LoadAd
   adview1.Visible=True
   adview1.BringToFront
   img.Visible=False
   panel1.SetLayout(0%x,3%y,60%x,70%y)
   img.SetLayout(0%x,3%y,60%x,70%y)
   txttesto.SetLayout(61%x,3%y,39%x,15%y)
   btncanvas.SetLayout(61%x,19%y,39%x,15%y)
   btnvedi.SetLayout(61%x,35%y,39%x,15%y)
   speffects.SetLayout(61%x,51%y,39%x,15%y)
   btntakepicture.SetLayout(61%x,67%y,39%x,15%y)
   
   Canvas1.Initialize(panel1)
   rect1.Initialize(0, 0, panel1.Width, panel1.Height)
   ToastMessageShow("PREMERE UNA VOLTA SU FLASH PER ABILITARLO, PREMERE A LUNGO PER DISABILITARLO",True)
   
   speffects.Add("MONO")
   speffects.Add("NEGATIVE")
   speffects.Add("POSTERIZE")
   speffects.Add("SEPIA")
   speffects.Add("SOLARIZE")
   speffects.Add("FLAS ON")
   speffects.Add("FLAS OFF")
End Sub
Sub Activity_Resume
     camera1.Initialize(panel1, "camera1")
End Sub
Sub camera1_Ready (Success As Boolean)
   If Success  Then
   camera1.StartPreview
   Else
      ToastMessageShow("Cannot open camera.", True)
   End If
End Sub
my libraries using: acl v. 4.60
please helpme. 
thanks
 

stefanoa

Active Member
Licensed User
Longtime User
you can try:

B4X:
Sub camera1_Ready (Success As Boolean)

    If Success = Null then Success = False    '<<< Add this line

    If Success  Then
    camera1.StartPreview
    Else
        ToastMessageShow("Cannot open camera.", True)
    End If
End Sub
 
Upvote 0

fifiddu70

Well-Known Member
Licensed User
Longtime User
you mean this?


B4X:
** Service (ms) Start **


** Activity (main) Create, isFirst = true **
** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


Reposting event: camera1_ready


** Activity (main) Create, isFirst = false **


** Activity (main) Resume **


main_camera1_ready (java line: 407)


java.lang.NullPointerException


   at xvs.ACL.ACL.StartPreview(ACL.java:196)
   at com.siciliabit.camera.main._camera1_ready(main.java:407)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
   at anywheresoftware.b4a.BA$3.run(BA.java:301)
   at android.os.Handler.handleCallback(Handler.java:605)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4441)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
   at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Service (ms) Start **


** Service (ms) Start **
 
Upvote 0
Top