Android Question Imageview_click inside a Scrollview

Hccsoft

Member
Licensed User
Hello,

I put five Imageview in a Scrollview. How can I add the imageview1_click, imageview2_click...?
I would like to make an action with each image.

Dim comedor as ImageView
comedor.Initialize("")
comedor.Bitmap = LoadBitmap (File.DirAssets, "comedor.jpg")
comedor.Gravity = Gravity.FILL
ScrollView1.Panel.AddView(comedor, 1dip, 1dip , ScrollView1.Width , 155dip)
[...]

Thank you
 

eurojam

Well-Known Member
Licensed User
Hccsoft,
this is very easy with b4a, use an eventname and may be a tag for your imageview like:
B4X:
Dim comedor as ImageView
  comedor.Initialize("comedor")
  comedor.tag = "muy bien comida...."
and then you can handle the event like this:

B4X:
Sub comedor_Click
  Dim send As ImageView
  send = Sender
  'do anything with the imageview....
  Log("Sender " & Send.tag)
end sub
hope this helps
Stefan
 
Top