user3222270
user3222270

Reputation: 29

How to add voice output in android?

I m making a quiz type app.
I want that when the user types the correct or incorrect answer, the user should be informed through spoken voice in addition to display.

how can we implement this thing in android?

Upvotes: 1

Views: 414

Answers (2)

venergiac
venergiac

Reputation: 7717

I think you need the TextToSpeech functionnality provided by android (Added in API level 4) http://developer.android.com/reference/android/speech/tts/TextToSpeech.html

TextToSpeech ttobj=new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
   @Override
   public void onInit(int status) {
   }
}
);

ttobj.setLanguage(Locale.UK);

and finally

ttobj.speak(text, TextToSpeech.QUEUE_FLUSH, null);

Upvotes: 1

Phantômaxx
Phantômaxx

Reputation: 38098

So you want a tutorial on TTS (Text To Speech).
Here's one.

Upvotes: 1

Related Questions