I am developing one android application,
In that application i need to use 5 languages,
application lets user to choice different language. according to user select the language
for that what i have to do?
give me any suggestion for this.....
This is easy to do.. for example using spinner to select a language. See the following code...
public void onCreate(Bundle savedInstanceState) {
mTts = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
}
public void onInit(int status) {
if (status != TextToSpeech.ERROR) {
ttsIsInit = true;
}
}
});
read.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (mTts != null && ttsIsInit) {
mTts.speak(exitTextFound, TextToSpeech.QUEUE_FLUSH, null);
}
}
});
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3) {
language = language_array[spinner.getSelectedItemPosition()];
if (language.equals("English US")) {
mTts.setLanguage(Locale.US);
} else if (language.equals("Francais")) {
mTts.setLanguage(Locale.FRANCE);
} else if (language.equals("Espanol")) {
mTts.setLanguage(new Locale("es"));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With