I am creating one application which convert text into speech in Indian English.
I got this("English, India (en_IN)") value from one site but i don't know how and where
set this value to locale. Please give me hint how to set this language.
And it's necessary to change mobile setting or not for TextToSpeech.
Thanks in Advance..
Asked
Active
Viewed 3,336 times
2

Sandip Armal Patil
- 6,241
- 21
- 93
- 160
1 Answers
5
Make sure you set the language only AFTER onInit() has happened.
Use the following code:
private TextToSpeech tts;
private void createTextToSpeechForIndianEnglish()
{
tts = new TextToSpeech(context, new OnInitListener()
{
@Override
public void onInit(int status)
{
if (status == TextToSpeech.SUCCESS)
{
tts.setLanguage(new Locale("en", "IN"));
} else
{
//failed
}
}
});
}

gregm
- 12,019
- 7
- 56
- 78
-
can i use tts.setLanguage(Locale.getDefault());? – H Raval Oct 11 '16 at 08:34