Android Question Button Click

Ko Chit

New Member
Hello Everyone

I am beginner of B4A.
My problem is Button Click no work .
My code is ,


Sub Globals
Dim edt As EditText
Dim bt As Button

End Sub

Sub Activity_Create(FirstTime As Boolean)

edt.Initialize(edt)
Activity.AddView(edt,10%x,2%y,40%x,6%y)
edt.Hint="Input Your S/N"
edt.TextColor=0xFFEEEFE9
edt.HintColor=0xFF08BB00

bt.Initialize(bt)
Activity.AddView(bt,10%x,10%y,30%x,5%y)
bt.Text="Click Now"
bt.TextColor=0xFF1A64DA
bt.SetBackgroundImage(LoadBitmap(File.DirAssets,"Button 1.png"))

Msgbox("Hi","Good Morning")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub bt_click
Msgbox("edt","Please Check Your Info")
End Sub


So please help me.

With best regards,
Chit
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
First of all, when you post your code, please surround it with the code tags. Secondly - I'm not sure why you're not using a layout, but that's your choice I guess.

Thirdly, when you initialize the button, the prefix for the Click event should be a String:
B4X:
bt.Initialize("bt")

- Colin.
 
Upvote 0

Ko Chit

New Member
First of all, when you post your code, please surround it with the code tags. Secondly - I'm not sure why you're not using a layout, but that's your choice I guess.

Thirdly, when you initialize the button, the prefix for the Click event should be a String:
B4X:
bt.Initialize("bt")

- Colin.


Thank your for your advice.
I will try to use Designer later.
I like this.
 
Upvote 0
Top