Android Question BitmapsAsync Grid specific image click event: I need an example

MarcoRome

Expert
Licensed User
Longtime User
As already requested by yiankos1, I too would like to capture the click events of each image. As indicated by Erel BitmapsAsync Grid specific image click event
I created an event for each Image, unfortunately the only thing I can get is the click on the panel but not the one related to the image, how to do it?
Thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Your question has nothing to do with BitmapsAsync. BitmapsAsync is just responsible for loading bitmaps.
2. Don't use BitmapsAsync. Use SimpleMediaManager instead.

A modified version of SMM_Example2 is attached. It handles the click event (B4A only - should be trivial to make same changes in layout in B4J and B4i).
 

Attachments

  • SMM_Example2.zip
    186.4 KB · Views: 190
Upvote 0
1. Your question has nothing to do with BitmapsAsync. BitmapsAsync is just responsible for loading bitmaps.
2. Don't use BitmapsAsync. Use SimpleMediaManager instead.

A modified version of SMM_Example2 is attached. It handles the click event (B4A only - should be trivial to make same changes in layout in B4J and B4i).
Considering that the bread in B4J, unlike the B4A panel does not have the click event, I used this code that works. Is there a better way? If no one answers then it means this is the only way.

Added pane click event in B4J:
#if B4A
Private Sub pnlImage_Click
    Dim ImageIndex As Int = Sender.As(B4XView).Tag
    Log($"Clicked on image: ${ImageIndex}"$)
End Sub
#else

Private Sub pnlImage_MouseClicked (EventData As MouseEvent)
    Dim ImageIndex As Int = Sender.As(B4XView).Tag
    Log($"Clicked on image: ${ImageIndex}"$)
End Sub
#end if
 
Upvote 0
Top