Code example for TextToSpeech

0
    private final AtomicBoolean isShutdown;
    /** Handles speech events asynchronously. */ 
    private final Handler speechHandler = new Handler();
 
    public Talker(final Context context) {
        tts = new TextToSpeech(context, this);
        ttsLatch = new CountDownLatch(1);
        isShutdown = new AtomicBoolean(false);
    } 
 
    /** 
     * Says the speech. 
     * 
     * @param speech the speech to speak 
     */ 
    public void say(final String speech) {
        sayLater(speech, 0L);
    } 
 
    /**