android, text to speech -
i'm playing text speech make testapp little more fun. works in emulator not on phone since default locale isn't english.
however, texts english tts should of course use english. far know can implement autoninstall, like
public void oninit(int status) { if (status == texttospeech.success) { // set preferred language english. int result = mtts.setlanguage(locale.us); if (result == texttospeech.lang_missing_data || result == texttospeech.lang_not_supported) { // lanuage data missing or language not supported. log.e(tag, "language not available."); } else { // tts engine has been initialized. speak(); } } else { // missing data, install intent installintent = new intent(); installintent.setaction( texttospeech.engine.action_install_tts_data); startactivity(installintent); } } but, want to? installing locales take lot of space? mess else?
regards
you should execute this:
// missing data, install intent installintent = new intent(); installintent.setaction( texttospeech.engine.action_install_tts_data); startactivity(installintent); when lang_missing_data
Comments
Post a Comment