I have this code:
How can I go to an Sub imgAgnDelete_Click with this code. The idea is to delete a row with an id from the database when someone clicks on the image.
B4X:
For i = 0 To Cursor.RowCount -1
Dim Height, Height2 As Float
Dim lblAgnDatum, lblAgnVak,lblAgnId As Label
Dim datumveld As String
Dim imgAgnDelete As ImageView
lblAgnDatum.Initialize("")
lblAgnVak.Initialize("")
lblAgnId.Initialize("")
imgAgnDelete.Initialize("")
imgAgnDelete.Bitmap = LoadBitmap(File.DirAssets,"delete.png")
Agendaoverzicht.Panel.Height=Agendaoverzicht.Height
Agendaoverzicht.Panel.Color = Colors.Transparent
Cursor.Position = i
DateTime.DateFormat="dd/MM/yyyy"
datumveld=DateTime.Date(Cursor.GetLong("datum"))
lblAgnDatum.Text=datumveld
lblAgnVak.Text=Cursor.GetString("vak")
lblAgnVak.TextColor = Colors.Black
lblAgnVak.TextSize = 12
lblAgnDatum.TextColor = Colors.Black
lblAgnDatum.TextSize = 15
lblAgnId.Text=Cursor.GetInt("id")
imgAgnDelete.Tag = Cursor.GetInt("id")
Agendaoverzicht.Panel.AddView(lblAgnDatum, 5dip, 5dip + TotalHeight, Agendaoverzicht.Width, -2)
Agendaoverzicht.Panel.AddView(lblAgnVak, 5dip, 25dip + TotalHeight, Agendaoverzicht.Width, -2)
Agendaoverzicht.Panel.AddView(imgAgnDelete, 250dip, 8dip + TotalHeight, 20, 20)
DoEvents
Reflect.Target=lblAgnDatum
Height=Reflect.RunMethod("getHeight")
DoEvents
Reflect.Target=lblAgnVak
Height2=Reflect.RunMethod("getHeight")
TotalHeight=TotalHeight+Height+Height2
Agendaoverzicht.Panel.Height=TotalHeight
Next
How can I go to an Sub imgAgnDelete_Click with this code. The idea is to delete a row with an id from the database when someone clicks on the image.