Hi all:
My workmates use my app to make a lot of pics of their jobs. I use to make the pictures CameraExClass 1.30.
Some of them get an error while making pictures, and I can't reproduce it. I mean, they say they're just pressing the take picture button, and sometimes they get this error.
I get an error in checklist_activity_create, but I think this is not the error that stops my app.
Probably the error stops my app is: "java.lang.RuntimeException: takePicture failed"
This is the code in the Cam1 activity, in which I take the picture
Thanks
They send me the error with logcat
My workmates use my app to make a lot of pics of their jobs. I use to make the pictures CameraExClass 1.30.
Some of them get an error while making pictures, and I can't reproduce it. I mean, they say they're just pressing the take picture button, and sometimes they get this error.
I get an error in checklist_activity_create, but I think this is not the error that stops my app.
Probably the error stops my app is: "java.lang.RuntimeException: takePicture failed"
This is the code in the Cam1 activity, in which I take the picture
B4X:
Sub btnTakePicture_Click
ProgressBar1.Visible = True
ProgressBar1.BringToFront
camEx.TakePicture
End Sub
Sub Camera1_PictureTaken (Data() As Byte)
Dim NombreFoto As String
Dim ListaFotos As List
ListaFotos = Starter.SiteActual.MapFotos.GetVAlueAt(Spinner1.SelectedIndex)
Do While File.Exists(Starter.Directorio & "/" & Starter.SiteActual.Site & "_" & Starter.SiteActual.Tecnologia &"/", Spinner1.SelectedItem.SubString2(0,4).Trim & "(" & IndiceFoto & ").jpg")
IndiceFoto = IndiceFoto + 1
Loop
NombreFoto = Spinner1.SelectedItem.SubString2(0,4).Trim & "(" & IndiceFoto & ").jpg"
Dim dir As String =Starter.Directorio & "/" & Starter.SiteActual.Site & "_" & Starter.SiteActual.Tecnologia &"/" 'Anteriormente File.DirInternal
camEx.SavePictureToFile(Data, dir, NombreFoto)
camEx.StartPreview 'restart preview
If File.Size(dir, NombreFoto) > 1500000 Then
ToastMessageShow("Resolución demasiado alta, baje la resolución de la cámara a algún valor intermedio pulsando la rueda dentada", True)
Else If File.Size(dir, NombreFoto) < 350000 Then
ToastMessageShow("REPITA LA FOTO. Resolución demasiado baja, suba la resolución de la cámara a algún valor intermedio pulsando la rueda dentada.", True)
End If
ListaFotos.Add(NombreFoto)
Starter.SiteActual.MapFotos.Put(Spinner1.SelectedItem, ListaFotos)
ProgressBar1.Visible = False
End Sub
Thanks
They send me the error with logcat
B4X:
--------- beginning of system
--------- beginning of main
~i:*** Service (starter) Create ***
~i:** Service (starter) Start **
~i:** Activity (checklist) Create, isFirst = true **
~e:checklist_activity_create (java line: 380)
~e:java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
~e: at com.semi.bqa.checklist._activity_create(checklist.java:380)
~e: at java.lang.reflect.Method.invoke(Native Method)
~e: at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
~e: at com.semi.bqa.checklist.afterFirstLayout(checklist.java:104)
~e: at com.semi.bqa.checklist.access$000(checklist.java:17)
~e: at com.semi.bqa.checklist$WaitForLayout.run(checklist.java:82)
~e: at android.os.Handler.handleCallback(Handler.java:795)
~e: at android.os.Handler.dispatchMessage(Handler.java:99)
~e: at android.os.Looper.loop(Looper.java:166)
~e: at android.app.ActivityThread.main(ActivityThread.java:6861)
~e: at java.lang.reflect.Method.invoke(Native Method)
~e: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:450)
~e: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
java.lang.RuntimeException: takePicture failed
at android.hardware.Camera.native_takePicture(Native Method)
at android.hardware.Camera.takePicture(Camera.java:1513)
at android.hardware.Camera.takePicture(Camera.java:1455)
at anywheresoftware.b4a.objects.CameraW.TakePicture(CameraW.java:287)
at com.semi.bqa.cameraexclass._takepicture(cameraexclass.java:812)
at com.semi.bqa.cam1._btntakepicture_click(cam1.java:626)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6367)
at android.view.View$PerformClick.run(View.java:25040)
at android.os.Handler.handleCallback(Handler.java:795)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:6861)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:450)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)