I am trying to start an activity when user clicks one of the panels held by an Horizontal Scroll View.
I read it's done with tags but I couldn't figure out how.
I have a for loop generating the panels and an array holding the said panels.
You need to initialize the panels with an event name then create a sub {eventname}_Click, read the tag and start the activity.
Code from your previous question, if it's the same or related code.
B4X:
Dim Panels(667) As Panel
Sub CreatePanels
For i = 0 to 666
Dim cw as Panel
cw.Initialize("Panels")
cw.Tag = ActivityName 'See Note 1
Panels(i) = cw
Desiredview.Panel.AddView(cw,Left,Top,Width,Height)
Next
End sub
Sub Panels_Click
Dim P As Panel = Sender
StartActivity(P.Tag)
End Sub
Note 1: You will need to decide how to assign the activity you want to start from each panel to the tag. Either within the loop using another array or list or separately: