當前位置: 首頁>>代碼示例>>Java>>正文


Java TextToSpeech.LANG_MISSING_DATA屬性代碼示例

本文整理匯總了Java中android.speech.tts.TextToSpeech.LANG_MISSING_DATA屬性的典型用法代碼示例。如果您正苦於以下問題:Java TextToSpeech.LANG_MISSING_DATA屬性的具體用法?Java TextToSpeech.LANG_MISSING_DATA怎麽用?Java TextToSpeech.LANG_MISSING_DATA使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.speech.tts.TextToSpeech的用法示例。


在下文中一共展示了TextToSpeech.LANG_MISSING_DATA屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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!");
        }
    });
}
 
開發者ID:GuepardoApps,項目名稱:LucaHome-AndroidApplication,代碼行數:20,代碼來源:TTSController.java

示例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");
    }
}
 
開發者ID:nrkdrk,項目名稱:Image-Text-Reader-And-Tools,代碼行數:22,代碼來源:TextToSpeechActivity.java

示例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()));
        }
      }
    });
  }
 
開發者ID:nordfalk,項目名稱:EsperantoRadio,代碼行數:24,代碼來源:Talesyntese.java

示例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!");
                }
            }
        });
    }
 
開發者ID:aidaferreira,項目名稱:synesthesiavision,代碼行數:25,代碼來源:TextToSpeechManager.java

示例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);
    }
}
 
開發者ID:quaap,項目名稱:PhoneFoneFun,代碼行數:17,代碼來源:TextToVoice.java

示例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!!");
    }


}
 
開發者ID:NullPointersInc,項目名稱:Bella-Android,代碼行數:14,代碼來源:MainActivity.java

示例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);
}
 
開發者ID:jiangkang,項目名稱:KTools,代碼行數:27,代碼來源:AudioActivity.java

示例8: isLanguageAvailable

public int isLanguageAvailable(Locale loc) {
  return TextToSpeech.LANG_MISSING_DATA;
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:3,代碼來源:ExternalTextToSpeech.java


注:本文中的android.speech.tts.TextToSpeech.LANG_MISSING_DATA屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。