本文整理匯總了Java中android.speech.tts.TextToSpeech.LANG_NOT_SUPPORTED屬性的典型用法代碼示例。如果您正苦於以下問題:Java TextToSpeech.LANG_NOT_SUPPORTED屬性的具體用法?Java TextToSpeech.LANG_NOT_SUPPORTED怎麽用?Java TextToSpeech.LANG_NOT_SUPPORTED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.speech.tts.TextToSpeech
的用法示例。
在下文中一共展示了TextToSpeech.LANG_NOT_SUPPORTED屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Init
public void Init() {
if (_ttsInitialized) {
Logger.getInstance().Warning(TAG, "Already initialized!");
return;
}
_ttsSpeaker = new TextToSpeech(_context, status -> {
if (status == TextToSpeech.SUCCESS) {
int result = _ttsSpeaker.setLanguage(Locale.US);
if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
Logger.getInstance().Error(TAG, "This Language is not supported!");
} else {
_receiverController.RegisterReceiver(_speakReceiver, new String[]{TTS_SPEAK_TEXT_BROADCAST});
_ttsInitialized = true;
}
} else {
Logger.getInstance().Error(TAG, "Initialization failed!");
}
});
}
示例2: onInit
@Override
public void onInit(int status) {
// TODO Auto-generated method stub
if (status == TextToSpeech.SUCCESS) {
//int result= tts.setLanguage(Locale.ENGLISH);
Locale locale = new Locale("tr", "TR");
int result = tts.setLanguage(locale);
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("TTS", "Language is not supported");
} else {
btn_konus.setEnabled(true);
String text = editText1.getText().toString();
speakOut(text);
}
} else {
Log.e("TTS", "Initilization Failed");
}
}
示例3: init
public void init(Context ctx) {
prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
prefsÆndret();
tts = new TextToSpeech(ctx, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
initialiseret = true;
int res = tts.setLanguage(new Locale("da", ""));
if (res == TextToSpeech.LANG_MISSING_DATA || res == TextToSpeech.LANG_NOT_SUPPORTED) {
res = tts.setLanguage(Locale.getDefault());
if (res == TextToSpeech.LANG_MISSING_DATA || res == TextToSpeech.LANG_NOT_SUPPORTED) {
res = tts.setLanguage(Locale.US);
if (res == TextToSpeech.LANG_MISSING_DATA || res == TextToSpeech.LANG_NOT_SUPPORTED) {
initialiseret = false;
}
}
}
// udtal("Tekst til tale initialiseret for sproget " + tts.getLanguage().getDisplayLanguage(tts.getLanguage()));
}
}
});
}
示例4: createTTS
private void createTTS() {
//Creates an instance of Google API TTS
mTTS = new TextToSpeech(mContext, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
//If initializaation is sucessful so set language.
if (status == TextToSpeech.SUCCESS) {
//Set language to PT-BR and get the value returned
int result = mTTS.setLanguage(new Locale("pt", "br"));
//Check if the language is supported, if not print it on Android Monitor.
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("TextToSpeechManager", "This Language is not supported");
}
} else {
Log.e("TextToSpeechManager", "Initilization Failed!");
}
}
});
}
示例5: onInit
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int result = mTts.setLanguage(Locale.getDefault());
isInit = true;
if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("error", "This Language is not supported");
}
Log.d("TextToSpeech", "Initialization Suceeded! " + System.currentTimeMillis());
speak(mContext.getString(R.string.hello1) + ",");
} else {
Log.e("error", "Initialization Failed! " + status);
}
}
示例6: onInit
@Override
public void onInit(int status) {
if(status == TextToSpeech.SUCCESS) {
Locale English = tts.getLanguage();
int result = tts.setLanguage(English);
if(result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("TTS","this language is not supported");
}
} else {
Log.e("TTS","Initialization failed!!");
}
}
示例7: onBtnTextToSpeechClicked
@OnClick(R.id.btn_text_to_speech)
public void onBtnTextToSpeechClicked() {
onInitListener = new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int result = speech.setLanguage(Locale.ENGLISH);
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
ToastUtils.showShortToast("語言不支持");
} else {
String content = "This is a default voice";
if (!TextUtils.isEmpty(etTextContent.getText().toString())) {
content = etTextContent.getText().toString();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
speech.speak(content, TextToSpeech.QUEUE_FLUSH, null, null);
} else {
speech.speak(content, TextToSpeech.QUEUE_FLUSH, null);
}
}
}
}
};
speech = new TextToSpeech(this, onInitListener);
}