Android Question Sender for List

Hello.
I have:

Sub Globals
Dim lstViews As List

Here's how I form a List:

Sub Activity_Create(FirstTime As Boolean)
lstViews.Initialize
For Each vw As View In Activity
lstViews.Add(vw)
Next

As a result, I would like to track the Click event to various objects, the ImageView is especially important to me: I want the images to respond to Click.

But this procedure does not work:

Sub lstViews_Click
Dim vw As View
vw = Sender
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Please use [code]code here...[/code] tags when posting code.

If you are creating a new project then don't waste your time with activities. Switch to B4XPages.

Your code can't work. List doesn't have a click event. It is a collection.
Correct code:
B4X:
Sub ImageView1_Click

End Sub
You can also set the event name of many views to be the same and then use Sender to find the view that raised the event.
 
Upvote 0
Please use [code]code here...[/code] tags when posting code.

If you are creating a new project then don't waste your time with activities. Switch to B4XPages.

Your code can't work. List doesn't have a click event. It is a collection.
Correct code:
B4X:
Sub ImageView1_Click

End Sub
You can also set the event name of many views to be the same and then use Sender to find the view that raised the event.
Thank you!
 
Upvote 0
Top