Android Question Detect Simple Media Manager click event?

Scantech

Well-Known Member
Licensed User
Longtime User
In Item designer there are 4 panels with 1 label in each panels. The label contains the numbers in text field. How can i trap which label is clicked?
I had a hard time figuring it out using tag and sender.

B4X:
Sub CustomListView1_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
    For Each i As Int In PCLV.VisibleRangeChanged(FirstIndex, LastIndex)
        Dim item As CLVItem = CustomListView1.GetRawListItem(i)
        Dim pnl As B4XView = xui.CreatePanel("PanelNumber")
        item.Panel.AddView(pnl, 0, 0, item.Panel.Width, item.Panel.Height)
        Dim data As MyImageData = item.Value
        'Create the item layout
        pnl.LoadLayout("item")
        For x = 0 To 3
            pnl.GetView(x).GetView(1).Text = data.IndexOfFirstImage + x
            MediaManager.SetMedia(pnl.GetView(x).GetView(0), $"https://picsum.photos/id/${data.IndexOfFirstImage + x}/200/300.jpg"$)
        Next
    Next
    'The purpose of this call is to find panels that are no longer in the views tree and cancel any ongoing request that is no longer relevant.
    'It also happens automatically from time to time but in this case, as many requests are sent frequently, it is better to force it to trim the cache.
    'Note that you need to add HU2_PUBLIC to the build configuration.
    MediaManager.TrimMediaCache
End Sub
 

Scantech

Well-Known Member
Licensed User
Longtime User
Here is an attached example. Click on the pictures. The Sub PanelItems_Click is incomplete and can't figure this out. Thanks in advance.
 

Attachments

  • SMM Test.zip
    12.1 KB · Views: 90
Upvote 0
Top