i run one test with this code (and library)(in debug mode):
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Button1 As Button
Dim camera1 As Camera
Dim Panel1 As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("2")
End Sub
Sub Activity_Resume
camera1.Initialize(Panel1 ,"camera1")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
StartServiceAt(retorna1,DateTime.Now+(5*2000),False )
End Sub
Sub Button2_Click 'sacar foto
camera1.TakePicture
End Sub
Sub Camera1_Ready (Success As Boolean)
If Success Then
camera1.StartPreview
Else
Log("camara ready -> Cannot open camera")
End If
End Sub
step of test:
1) execute code, work
2) incomign call
3) return to all
and exist this log of error of "startpreview":
PackageAdded: package:ejm.fotosb4a
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
main_camera1_ready (B4A line: 75)
camera1.StartPreview
java.io.IOException: setPreviewDisplay failed
at android.hardware.Camera.setPreviewDisplay(Native Method)
at android.hardware.Camera.setPreviewDisplay(Camera.java:399)
at anywheresoftware.b4a.objects.CameraW.StartPreview(CameraW.java:176)
at ejm.fotosb4a.main._camera1_ready(main.java:454)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:538)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:158)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
at anywheresoftware.b4a.objects.CameraW$2$1.run(CameraW.java:139)
at android.os.Handler.handleCallback(Handler.java:618)
at android.os.Handler.dispatchMessage(Handler.java:123)
at android.os.Looper.loop(SourceFile:351)
at android.app.ActivityThread.main(ActivityThread.java:3814)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:538)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659)
at dalvik.system.NativeStart.main(Native Method)