当前位置: 首页>>代码示例>>Java>>正文


Java TextToSpeech.LANG_NOT_SUPPORTED属性代码示例

本文整理汇总了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!");
        }
    });
}
 
开发者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


注:本文中的android.speech.tts.TextToSpeech.LANG_NOT_SUPPORTED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。