Android Question UltimateListView occasional error

skaliwag

Member
Licensed User
Longtime User
Simplified Code Block:
Sub Item_LayoutCreator(LayoutName As String, LayoutPanel As Panel)
     Dim imgCard As ImageView '0
    imgCard.Initialize("")
    imgCard.Gravity=Gravity.FILL
    LayoutPanel.AddView(imgCard,0,0,ImageW,ImageH)
End Sub

Sub Item_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)   
     Dim imgCard As ImageView
    Try
        imgCard=LayoutPanel.GetView(0)
    Catch
        Log("error - View0 is not ready")
        Return
    End Try
End Sub

Occasionally, this Try..Catch will trigger.
It is rare, and I have been unable to find any instance in which it is predictable or repeatable on demand.
So 2 questions :-
1. What could be causing the ContentFiller to be called before the LayoutCreator?
2. Is there a better way of handling the error (currently, it gives a blank entry which fixes itself when scrolled)?

Thank you.
 

skaliwag

Member
Licensed User
Longtime User
Simplified Code Block:
Sub Item_LayoutCreator(LayoutName As String, LayoutPanel As Panel)
     Dim imgCard As ImageView '0
    imgCard.Initialize("")
    imgCard.Gravity=Gravity.FILL
    LayoutPanel.AddView(imgCard,0,0,ImageW,ImageH)
End Sub

Sub Item_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)  
     Dim imgCard As ImageView
    Try
        imgCard=LayoutPanel.GetView(0)
    Catch
        Log("error - View0 is not ready")
        Return
    End Try
End Sub

Occasionally, this Try..Catch will trigger.
It is rare, and I have been unable to find any instance in which it is predictable or repeatable on demand.
So 2 questions :-
1. What could be causing the ContentFiller to be called before the LayoutCreator?
2. Is there a better way of handling the error (currently, it gives a blank entry which fixes itself when scrolled)?

Thank you.
Simplified Code Block:
Sub Item_LayoutCreator(LayoutName As String, LayoutPanel As Panel)
     Dim imgCard As ImageView '0
    imgCard.Initialize("")
    imgCard.Gravity=Gravity.FILL
    LayoutPanel.AddView(imgCard,0,0,ImageW,ImageH)
End Sub

Sub Item_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)  
     Dim imgCard As ImageView
    Try
        imgCard=LayoutPanel.GetView(0)
    Catch
        Log("error - View0 is not ready")
        Item_LayoutCreator(LayoutName,LayoutPanel)
        imgCard=LayoutPanel.GetView(0)
    End Try
End Sub

Update - I have not found what is causing the problem, but this seems to work as a fix
 
Upvote 0
Top