java - Get available TTS languages -
how can list of available english tts languages , available spanish tts languages? i'd allow user choose english voice , spanish voice use.
i have working solution. hope helps similar problem.
locale[] locales = locale.getavailablelocales(); list<locale> localelistenglish = new arraylist<locale>(); list<locale> localelistspanish = new arraylist<locale>(); (locale locale : locales) { if (tts.islanguageavailable(locale) == texttospeech.lang_available) { if (locale.getlanguage().equals("en")) localelistenglish.add(locale); else if (locale.getlanguage().equals("es")) localelistspanish.add(locale); } } string message = new string(""); (int = 0; < localelistenglish.size(); i++) message += localelistenglish.get(i) + "\n"; (int = 0; < localelistspanish.size(); i++) message += localelistspanish.get(i) + "\n"; log.i("debug", message);
Comments
Post a Comment