Android Question Sub EditText1_TextChanged inside Button1_Click

Isac

Active Member
Licensed User
tts1.Speak(EditText1.Text,True)I want him to talk when I press the button, I have trouble moving the sub in the button.
I would call this sub inside the button.

thank you

B4X:
Sub EditText1_TextChanged (Old As String, New As String)
    If EditText1.Text.Length > 0 AND EditText1.Text <> Old  Then
    tts1.Speak(EditText1.Text,True)
    End if

[CODE]Sub Button1_Click

 
EditText1_TextChanged (Old As String, New As String)

End Sub
 
Last edited:

eurojam

Well-Known Member
Licensed User
Code it like this - put your speak in a routine and call it:
B4X:
Sub speak (s As String)
   tts1.speak(s,True)
End Sub
Sub EditText1_TextChanged (Old As String, New As String)
    If EditText1.Text.Length > 0 AND EditText1.Text <> Old  Then
     speak(EditText1.Text)
    End If
End Sub
Sub Button1_Click
  speak(EditText1.Text)

End Sub
Stefan
 
Top