Android – Text to speech simple example

android   In this article I will show the most simple way to add text to speech abilities to your Android application.

public class Text2SpeechTest extends Activity implements OnInitListener {

	TextToSpeech talker;

    public void onCreate(Bundle savedInstanceState) {
        talker = new TextToSpeech(this, this);

    public void say(String text2say){
    	talker.speak(text2say, TextToSpeech.QUEUE_FLUSH, null);

	public void onInit(int status) {
		say("Hello World");


	public void onDestroy() {
		if (talker != null) {


Download code example

7 Replies to “Android – Text to speech simple example”

  1. Muy bueno. Funciona en el emulador y en mi tableta.
    Muchas gracias.

    Very good. It works in the emulator and on my tablet.
    Thank you very much.

  2. anyone knows how to add a language?, such as Spanish


    Alguien sabe como añadir un idioma que no esta soportado de serie, como por ejemplo Español.

    Gracias. un saludo.

  3. Can anyone tell that how to use google to speech tts and espeak app both in my application. i want to use both, randomly.

Leave a Reply

Your email address will not be published.