Android Question CustomListView -> jump to item

TheRealMatze

Active Member
Licensed User
Hi,
i just see a problem when jumping to a item in a custom list view. I have a view to create a new entry for the list. After going back to the list i want to jump to the item just inserted. That works as long as the item is not the last in the list. In this case the second-last item is the last in view. I see no reason why. My code to jump is this:

B4X:
Sub jumpTo(animalID As String)
    Log("show " & animalID)
    For x= 0 To clv1.Size-1
        Dim a As animalValue=clv1.GetValue(x)
        Log(">" & a.animalid)
        If a.animalID=animalID Then
            Log("Match!")
            If (x>=clv1.FirstVisibleIndex And x<=clv1.LastVisibleIndex ) Then
                Log("already in view")
            Else
                clv1.jumpToItem(x)
                Log("move view")
            End If   
        End If
    Next
    clv1.Refresh
End Sub

As i said, it works perfect - as long as the new item is not the last in the list.

Any ideas?

Thanks
Matze
 
Solution
Try to add Sleep(50) before jumping to the new item. If it doesn't work then please upload a small project that demonstrates it.
Top