#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim xui As XUI
Dim Dlg As B4XDialog
Dim DlgInput As B4XInputTemplate
Private LAB_EnteredText As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
Dlg.Initialize(Activity)
DlgInput.Initialize
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
EnterText(False)
End Sub
Private Sub Button2_Click
EnterText(True)
End Sub
Private Sub EnterText(PasswordMode As Boolean)
LAB_EnteredText.Text = ""
Dim et As EditText = DlgInput.TextField1
et.TextColor = xui.Color_Cyan
et.Gravity = Gravity.CENTER_HORIZONTAL
If PasswordMode Then
DlgInput.lblTitle.Text = "Enter password:"
et.PasswordMode = True
Else
DlgInput.lblTitle.Text = "Enter text:"
'' et.PasswordMode = True ' Comented out because of "First time crash"
End If
Dlg.Title = "Dialogtest"
Dlg.TitleBarColor = xui.Color_Blue
Dlg.TitleBarTextColor = xui.Color_Yellow
Dlg.ButtonsTextColor = Colors.RGB(50,205,50)
Wait For (Dlg.ShowTemplate(DlgInput, "OK", "", "CANCEL")) Complete (Result As Int)
If Result = xui.DialogResponse_Cancel Then Return
LAB_EnteredText.Text = DlgInput.text
End Sub