I'm using the MSDynamicGridView Library (https://www.b4x.com/android/forum/threads/msdynamicgridview-library.49331/page-4) from @thedesolatesoul to display images, since was release.
I update to the B4A 5.8 and move some variables from Main to Starter (the list with the names of file of imagens remains in the Main).
Now, in some devices I get this error (in others the error not occours).
I don't know the causes and how to fix it.
Someone that uses this library have the same issue?
This is my code:
I update to the B4A 5.8 and move some variables from Main to Starter (the list with the names of file of imagens remains in the Main).
Now, in some devices I get this error (in others the error not occours).
I don't know the causes and how to fix it.
Someone that uses this library have the same issue?
B4X:
~e:main_da_getcontent (java line: 1477)
~e:java.lang.NullPointerException: Attempt to read from field 'anywheresoftware.b4a.objects.collections.List br.com.myimages.main._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv6' on a null object reference
~e: at br.com.myimages.main._da_getcontent(main.java:1477)
~e: at java.lang.reflect.Method.invoke(Native Method)
~e: at java.lang.reflect.Method.invoke(Method.java:372)
~e: at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
~e: at com.maximussoft.gridviews.B4ADynamicGridAdapter.getView(B4ADynamicGridAdapter.java:66)
~e: at android.widget.AbsListView.obtainView(AbsListView.java:2344)
~e: at android.widget.GridView.onMeasure(GridView.java:1060)
~e: at android.view.View.measure(View.java:17448)
~e: at android.view.ViewGroup.measureChild(ViewGroup.java:5436)
~e: at android.view.ViewGroup.measureChildren(ViewGroup.java:5413)
This is my code:
B4X:
Sub DA_GetLayout(Position As Int, ItemID As Long, ItemTag As String) As Panel
Dim p As Panel
p.Initialize("")
Dim iv As ImageView
iv.Initialize("iv")
iv.Gravity = Gravity.Fill
p.AddView(iv, 1dip, 1dip, (pnlGrid.Width/NumCols)-2dip, (pnlGrid.Width/NumCols)-2dip)
Return p
End Sub
Sub DA_GetContent(Position As Int, ItemID As Long, ItemTag As String, ContentPanel As Panel) As Panel
Try 'change to capture the exception
Dim iv1 As ImageView = ContentPanel.GetView(0)
ContentPanel.Color = Colors.White
Dim Bitmap1 As Bitmap
Bitmap1.InitializeSample(File.DirAssets, GridItems.Get(ItemID), 200, 200)
iv1.Bitmap = Bitmap1
iv1.Visible = True
Catch
ToastMessageShow(LastException.Message & " - " & ItemID, False)
Log(LastException)
Log("ItemID: " & ItemID)
End Try
Return ContentPanel
End Sub