OCR, TTS - How can I find out when it ends speak command ?
I made an OCR application for blind people in which everything is spoken. I used OCR example from Erel. All is working fine. But in ShowText activity I want to go back to main activity automatically after result is spoken. So how can I find out when it ends speak command ?
I used
in Main activity to show result of OCR in ShowText activity.
I put here the code of ShowText activity.
I made an OCR application for blind people in which everything is spoken. I used OCR example from Erel. All is working fine. But in ShowText activity I want to go back to main activity automatically after result is spoken. So how can I find out when it ends speak command ?
I used
B4X:
CallSubDelayed2(ShowText, "ShowText", ResultString)
I put here the code of ShowText activity.
B4X:
#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 TTSResult As TTS
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 ResultMessage As String
Dim WebView1 As WebView
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("OCRResult")
TTSResult.Initialize("TTSResult")
TTSResult.SpeechRate=0.9
ResultMessage=""
End Sub
Sub Activity_Resume
If TTSResult.IsInitialized = False Then
TTSResult.Initialize("TTSResult")
TTSResult.SpeechRate=0.9
End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
TTSResult.Release
ResultMessage=""
End Sub
Sub TTSResult_Ready (Success As Boolean)
If Success Then
TTSResult.Speak("Rezultatul pentru recunoașterea optică a caracterelor este: " & ResultMessage, True)
Else
Msgbox("Eroare de inițializare TTS.", "")
End If
End Sub
Public Sub ShowText(Text As String)
WebView1.LoadHtml(Text)
ResultMessage=Text
End Sub
Last edited: