How do I add a refresh button? ( terminate a TextToSpeech message )

How can we add a refresh button in block by clicking on a button. Plse help

Welcome,

To refresh what?

What do you want to refresh ?

What do you mean by:

To refresh screen

As I want to stop text to speech when I click on back button to go back to screen 1 from screen2

Please help

You have to tell more about what you are trying to make, what you do on screen1 and on screen2.

also show what you have made sofar, for instance show your blocks.

I am making my holiday homework. I want that I am using text to speech in screen 2 and when I go back to screen 1 the text to speech goes on until it finishes. So i need that when I go to another screen the text to speech stops.

Then do not use two screens, use one screen and make virtual screens with arrangements

Use different screens wisely

If you decided to use different screens, then you should switch them correctly, else you will run out of memory after a while...      
The recommended method of switching screens in App Inventor
(Thanks Taifun)
 
Also see demo: multiscreen.aia
 
1 Like

But I can't because there are many topics that I had to shift them to another screen. Is there is any another method that I can stop the text to speech.

Plse tell if I can do something

I am not aware of a method available to stop textToSpeech once it has started. There may be an extension if you are allowed to use them in your homework..

I didn't got any extention. But thanks you helped me. If you get any information that it can stop so plse reply to me. Thanks.

This is the TextToSpeech Documentation TextToSpeech

Once you initiate TTS using Speak( message ) , it speaks the given message., you cannot stop it from finishing speaking the message as Tim mentioned,

You can try giving the TTS the Speak message with a Blank message. This might stop the previous speaking instance. Not tried. Does that work?

OK. Thank you Sir

You could split up the text you feed to TTS into shorter pieces, and put them into a list.
Pop the next piece off the list when TTS is done announcing the previous piece.
This way only a little bit of text will be completed when you close the screen.

Sample project:

Hello everyone, I have such a problem if I write a word in the textbox and press the button, then texttospeech voices it. Now the question is how you can stop it using another button, please help

Read what is written above ? There is no method to stop textToSpeech once it starts.

stopTTS

Button3 starts a TTS
Button4 terminates the TTS

:slight_smile: as suggested in an earlier post.

thank you very much