F Fsalcido888 New Member Mar 28, 2025 #1 Hi.... kind of new using B4A .... I'm trying to use TTS function on the very first opening screen which is call in Sub Activity_Create(FirstTime As Boolean). The original sub contains only this : Sub Activity_Create(FirstTime As Boolean) Activity.RemoveAllViews Activity.LoadLayout("HOME1") End Sub. But if I Add a TTS command after the activity load HOME1 and before the End Sub I will not get any error or syntax error but the created APK will fail (with no error message ) before showing anything on my phone Guess I tried all possible commands I know and posted on this website and I cant get it to run, 1. The same layout HOME1 is loaded from other click menus and it works fine using TSS calls. 2. All Other menus and TSS calls works perfect without issues. The Sub Activity_Create I created and ”fails” looks look like this: Sub Activity_Create(FirstTime As Boolean) Activity.RemoveAllViews Activity.LoadLayout("HOME1") TTS1.Speak("texto", True) TTS1.Speak("mas texto", False) End Sub Thanks.
Hi.... kind of new using B4A .... I'm trying to use TTS function on the very first opening screen which is call in Sub Activity_Create(FirstTime As Boolean). The original sub contains only this : Sub Activity_Create(FirstTime As Boolean) Activity.RemoveAllViews Activity.LoadLayout("HOME1") End Sub. But if I Add a TTS command after the activity load HOME1 and before the End Sub I will not get any error or syntax error but the created APK will fail (with no error message ) before showing anything on my phone Guess I tried all possible commands I know and posted on this website and I cant get it to run, 1. The same layout HOME1 is loaded from other click menus and it works fine using TSS calls. 2. All Other menus and TSS calls works perfect without issues. The Sub Activity_Create I created and ”fails” looks look like this: Sub Activity_Create(FirstTime As Boolean) Activity.RemoveAllViews Activity.LoadLayout("HOME1") TTS1.Speak("texto", True) TTS1.Speak("mas texto", False) End Sub Thanks.
Mehrzad238 Active Member Mar 28, 2025 #2 First of all, please use Code Statement. Second, not enough data to help! Upvote 0
MicroDrie Well-Known Member Licensed User Longtime User Mar 28, 2025 #3 Welcome Fsalcido888 on this forum. Fsalcido888 said: Hi.... kind of new using B4A .... I'm trying to use TTS function on the very first opening screen which is call in Sub Activity_Create(FirstTime As Boolean). The original sub contains only this : Click to expand... Firstly, you're suppose to use code tags </> to format the source: Code: Sub [B]Activity_Create[/B](FirstTime As Boolean) Activity.RemoveAllViews Activity.LoadLayout("HOME1") End Sub Secondly, the best thing you can do is made a small demo project which lead to your problem. I can't see which TTS library you use, nor how you initialize your TTS system. Fsalcido888 said: Hi.... kind of new using B4A .... I'm trying to use TTS function on the very first opening screen which is call in Sub But if I Add a TTS command after the activity load HOME1 and before the End Sub I will not get any error or syntax error but the created APK will fail (with no error message ) before showing anything on my phone Click to expand... We need more sour code to see what you have or not have done. Code: Sub Activity_Create(FirstTime As Boolean) Activity.RemoveAllViews Activity.LoadLayout("HOME1") TTS1.Speak("texto", True) TTS1.Speak("mas texto", False) End Sub Upvote 0
Welcome Fsalcido888 on this forum. Fsalcido888 said: Hi.... kind of new using B4A .... I'm trying to use TTS function on the very first opening screen which is call in Sub Activity_Create(FirstTime As Boolean). The original sub contains only this : Click to expand... Firstly, you're suppose to use code tags </> to format the source: Code: Sub [B]Activity_Create[/B](FirstTime As Boolean) Activity.RemoveAllViews Activity.LoadLayout("HOME1") End Sub Secondly, the best thing you can do is made a small demo project which lead to your problem. I can't see which TTS library you use, nor how you initialize your TTS system. Fsalcido888 said: Hi.... kind of new using B4A .... I'm trying to use TTS function on the very first opening screen which is call in Sub But if I Add a TTS command after the activity load HOME1 and before the End Sub I will not get any error or syntax error but the created APK will fail (with no error message ) before showing anything on my phone Click to expand... We need more sour code to see what you have or not have done. Code: Sub Activity_Create(FirstTime As Boolean) Activity.RemoveAllViews Activity.LoadLayout("HOME1") TTS1.Speak("texto", True) TTS1.Speak("mas texto", False) End Sub
MicroDrie Well-Known Member Licensed User Longtime User Mar 28, 2025 #4 The file extension MP3 is just like cars, a container concept. You have many different types and versions, because the MP3 file may have a bitrate that is supported by one player and not by another. Just relying on the name is not enough. Upvote 0
The file extension MP3 is just like cars, a container concept. You have many different types and versions, because the MP3 file may have a bitrate that is supported by one player and not by another. Just relying on the name is not enough.
klaus Expert Licensed User Longtime User Mar 29, 2025 #5 I tested your problem. It seems that Android does not allow TTS.Speak in the Activity_Create routine. Anyway, to me it does not make sense to speak any text when creating the Activity. In Debug mode it throws an error java.lang.RuntimeException: Error speaking text. B4X: Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("HOME1") TTS1.Initialize("TTS1") TTS1.Speak("texto", True) TTS1.Speak("mas texto", False) End Sub Then i tested the code in Activity_Resume, moving the two lines from Activity_Create to Activity_Resume. It throws the same error. B4X: Sub Activity_Resume TTS1.Speak("texto", True) TTS1.Speak("mas texto", False) End Sub But, this one works: B4X: Sub Activity_Resume Sleep(0) TTS1.Speak("texto", True) TTS1.Speak("mas texto", False) End Sub Upvote 0
I tested your problem. It seems that Android does not allow TTS.Speak in the Activity_Create routine. Anyway, to me it does not make sense to speak any text when creating the Activity. In Debug mode it throws an error java.lang.RuntimeException: Error speaking text. B4X: Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("HOME1") TTS1.Initialize("TTS1") TTS1.Speak("texto", True) TTS1.Speak("mas texto", False) End Sub Then i tested the code in Activity_Resume, moving the two lines from Activity_Create to Activity_Resume. It throws the same error. B4X: Sub Activity_Resume TTS1.Speak("texto", True) TTS1.Speak("mas texto", False) End Sub But, this one works: B4X: Sub Activity_Resume Sleep(0) TTS1.Speak("texto", True) TTS1.Speak("mas texto", False) End Sub
F Fsalcido888 New Member Apr 8, 2025 #6 Thank you for your response...I made this TSS issue to work with a sleep (1500) option before the first TSS command...seems to me that when the program is running the TSS function takes time to be operative when first invoque. Thank you Upvote 0
Thank you for your response...I made this TSS issue to work with a sleep (1500) option before the first TSS command...seems to me that when the program is running the TSS function takes time to be operative when first invoque. Thank you