I haven't managed to replicate the error myself, however a user of mine has experienced it.
He's tried to load the camera, and then it crashed with: "java.lang.NullPointerException: Attempt to get length of null array" which was caused by the bottom line.
To me, it seems as though the picture sizes came back null, in which case how and why had Success not been set as false?
On theory of mine, which I can't prove, or understand why it would happen, is in the GetSupportedPictureSizes function (see below) it failed the initial fetch and got caught by the try clause.
Has anyone seen this before, and/or think they might know what caused it??
Any help would be appreciated
He's tried to load the camera, and then it crashed with: "java.lang.NullPointerException: Attempt to get length of null array" which was caused by the bottom line.
B4X:
Sub Camera1_Ready (Success As Boolean)
If Success Then
' For TROUBLESHOOTING, check the resolution supported
Dim pictureSizes() As CameraSize = camEx.GetSupportedPicturesSizes
Dim previewSizes() As CameraSize = camEx.GetSupportedPreviewSizes
Dim LowResolution As Int = pictureSizes.Length - 1
To me, it seems as though the picture sizes came back null, in which case how and why had Success not been set as false?
On theory of mine, which I can't prove, or understand why it would happen, is in the GetSupportedPictureSizes function (see below) it failed the initial fetch and got caught by the try clause.
B4X:
Public Sub GetSupportedPicturesSizes As CameraSize()
Try
r.target = parameters
Dim list1 As List = r.RunMethod("getSupportedPictureSizes")
Dim cs(list1.Size) As CameraSize
For i = 0 To list1.Size - 1
r.target = list1.get(i)
cs(i).Width = r.GetField("width")
cs(i).Height = r.GetField("height")
Next
Return cs
Catch
Log(LastException)
End Try
End Sub
Has anyone seen this before, and/or think they might know what caused it??
Any help would be appreciated
Last edited: