#Region Project Attributes
#ApplicationLabel: Password generator
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#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.
Private B4XSeekBar1 As B4XSeekBar
Private Button1 As Button
Private ftf1 As B4XFloatTextField
Private Label1 As Label
Private Panel1 As Panel
Private lblnumber As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
Activity.Title = "Password generator"
ftf1.Text = ""
End Sub
Sub Activity_Resume
B4XSeekBar1.Value = 8
lblnumber.Text = 8
ftf1.Text = ""
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
generate_password
End Sub
Private Sub B4XSeekBar1_ValueChanged (Value As Int)
lblnumber.Text = B4XSeekBar1.Value
End Sub
Private Sub generate_password
Dim ww As String
Dim kar As String
Dim pos As Int
Dim abc As String = "abcdefghjkmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWXYZ"
Dim aantal As Int = lblnumber.Text
For i = 1 To aantal
pos = Rnd(1,abc.Length-1)
kar = abc.SubString2(pos,pos+1)
ww = ww & kar
Next
ftf1.Text = ww
Log(ww)
End Sub