Android Question Press the button through code

Rizal Putra

Member
Licensed User
Longtime User
What can I do to press the button through code, without knowing EventName of a button or Activity name.

usually in VB.NET, I use:
B4X:
Button1.PerformClick

how in B4A?
 

DonManfred

Expert
Licensed User
Longtime User
Put the logic from the button_click sub into a normal sub which you then just call...

Instead of

B4X:
sub button_click
' doing a lot of stuff here
end sub

you can do something like

B4X:
sub button_click
subwhodidthestuff
end sub
sub subwhodidthestuff
' doing a lot of stuff here
end sub

And if you then want to "simulate" a button click you just call the sub subwhodidthestuff
 
Upvote 0
Top