Android Question anyone can help me?

khosrwb

Active Member
Licensed User
Longtime User
what is problem in my app?
when I delete the this code my app worked truly:confused:
B4X:
For i=0 To 10
    listview1.AddTwoLines(i,i)
Next
 

Attachments

  • n.zip
    25.5 KB · Views: 143

RandomCoder

Well-Known Member
Licensed User
Longtime User
I'm guessing that by iterating through all the views contained within pnlContent what might be happening is that the ListView is actually returning not just the Listview but also the views contained within it and maybe this is what causes the error. Just my best guess!
Maybe trying checking if the View is a ListView before checking its position and size...
B4X:
Private Sub GetViewAtXY(X As Float, Y As Float) As Object
    For Each v As View In pnlContent.GetAllViewsRecursive
        If v Is ListView Then
            If X >= v.Left And X <= v.Left + v.Width And Y >= v.Top And Y <= v.Top + v.Height Then       'this line is 469
                Return v
            End If
        End If   
    Next
    Return Null
End Sub
 
Upvote 0
Top