I have 16 buttons that are created with the code below. When any of the buttons are clicked it opens a listview. When the user makes a selection on the listview I want to make that image the image of the button the user clicked on to open the list view. Any help would be appreciated.
B4X:
Dim x, y As Int
Dim width, offsetX, offsetY As Int
width = 37dip
offsetX = ((layoutval.Width - bts*47)/2)/2'left (100%x - width * sw - 10dip * 2 ) / 2
offsetY = 20'top(100%y - width * sw - 10dip * 2) / 2
For x = 0 To sw
For y = 0 To 1
Dim b As Button
b.Initialize("button") 'All buttons share the same event sub
Activity.AddView(b,offsetX + x * (width + 3dip), offsetY + y * (width + 3dip), width, width)
Buttons(x, y) = b 'store a reference to this view
Next
Next
B4X:
Sub Button_Click
'Using Sender we find the button that raised this event
Dim b As Button
b = Sender
'If b.Text <> "" Then Return 'Already used button
bt = Sender
Dim packages As List
Dim bt(500) As BitmapDrawable
listview1.Visible = True