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

6 thoughts on “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.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>