Android Question Detect which button was clicked

nibbo

Active Member
Licensed User
Longtime User
Hi, I have a multi-column scroll view which has a button column.
How can I tell in the click event which button was clicked?
i.e. in vb.net we would have the currentcell of a datagrid to identify the row.
Can I retrieve the tag name or something?
Thanks
 

klaus

Expert
Licensed User
Longtime User
Set the row number to the Tag property of the Buttons.
I suppose you have a fill routine and you have somewhere:
B4X:
For row = 0 To x
'
'
    Dim btn As Button
    btn.Initialize("Buttons")
    btn.Tag = row
'
'
Next
And then:
B4X:
Sub Buttons_Click
    Dim btn As Button
    Dim row As Int

    btn = Sender
    row = btn.Tag
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…