Hello all,
rotating my device causes my app to crash in line 9 (in orginal code line 273).
But the class instance is initialized before in public sub StartCamera.
Any suggestions about this behavior?
Thanks in advance,
Bernhard
rotating my device causes my app to crash in line 9 (in orginal code line 273).
But the class instance is initialized before in public sub StartCamera.
Any suggestions about this behavior?
Thanks in advance,
Bernhard
B4X:
Private Sub Camera1_Preview (CData() As Byte)
If DateTime.Now > LastPreview + IntervalBetweenPreviewsMs Then
'Dim n As Long = DateTime.Now
Dim frameBuilder As JavaObject
Dim bb As JavaObject
bb = bb.InitializeStatic("java.nio.ByteBuffer").RunMethod("wrap", Array(CData))
frameBuilder.InitializeNewInstance("com/google/android/gms/vision/Frame.Builder".Replace("/", "."), Null)
Dim cs As CameraSize = camEx.GetPreviewSize
frameBuilder.RunMethod("setImageData", Array(bb, cs.Width, cs.Height, 842094169))
' frameBuilder.RunMethod("setImageData", Array(bb, 400, 300, 842094169))
Dim frame As JavaObject = frameBuilder.RunMethod("build", Null)
Dim SparseArray As JavaObject = detector.RunMethod("detect", Array(frame))
LastPreview = DateTime.Now
Dim Matches As Int = SparseArray.RunMethod("size", Null)
If Matches > 0 Then
Dim barcode As JavaObject = SparseArray.RunMethod("valueAt", Array(0))
Dim raw As String = barcode.GetField("rawValue")
Dim numstr As String = raw.SubString2(1,11).As(Int).As(String)
If edit_papnr.Text <> numstr Then
edit_papnr.Text=numstr
Dim b As Beeper
b.Initialize(100,1600)
b.Beep
End If
' FoundBarcode(raw)
End If
End If
End Sub