Android Question Label Click just not triggered

Tomfromvienna0602

New Member
Licensed User
Hello,

I am a new User of B4A 5.5, registered, and i was trying out things to see how i can create interfaces by code.
When a label was generated, it just would not fire a click event.
Ok, so i downloaded some samples with designer screens, tried to generate the click event in a label on an activity, and again.
Click event did not fire.

Can someone point me in the right direction, i do not know what i do wrong.

(I tried emulator and B4A bridge on my phone.)
 

eurojam

Well-Known Member
Licensed User
Longtime User
Welcome,
try this one, this should work as expected:
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private lb As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    lb.Initialize("lb")
    Activity.AddView(lb, 10dip,10dip, 100dip,20dip)
    lb.Text="Click me!"
    lb.TextColor = Colors.red
End Sub

Sub lb_click
    Log("lb Click")
End Sub
Sub lb_longclick
    Log("lb long Click")
End Sub
 
Upvote 0
Top