#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.
Dim TTS1 As TTS
Dim tTemp As String
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 Button1 As Button
Dim Button2 As Button
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("1")
End Sub
Sub Activity_Resume
TTS1init
End Sub
Sub Activity_Pause (UserClosed As Boolean)
TTS1.Release
End Sub
Sub say(sentence As String)
sentence=sentence & " was pressed"
LogColor(sentence,Colors.Magenta)
If Not(TTS1.IsInitialized) Then
tTemp=sentence
TTS1init
Else
TTS1.Speak(sentence,True)
End If
End Sub
Sub TTS1init
If Not(TTS1.IsInitialized) Then
LogColor("TTS1init",Colors.green)
TTS1.Initialize("TTS1")
End If
End Sub
Sub TTS1_Ready (Success As Boolean)
LogColor("TTS1_Ready: "&Success,Colors.Green)
If Success Then
TTS1.Speak(tTemp,True)
Else
say(tTemp)
End If
End Sub
Sub Button2_Click
LogColor("button2",Colors.Red)
say("button 2")
End Sub
Sub Button1_Click
LogColor("button1",Colors.blue)
say("button 1")
End Sub