电话时

时间:2014-11-20 21:22:08

标签: java android text-to-speech

我在打电话的时候想要的。

我不知道如何在此代码中添加STREAM_VOICE_CALL

 public static TextToSpeech mTts;
 private int _langTTSavailable = -1; 
 protected static final int REQUEST_OK = 1;
 TextView text;





 @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Var.RepeteReponce = Var.Reponce;
    Var.RepeteDuree = Var.Duree;


    String Information = Var.Information;

    mTts = new TextToSpeech(this, (OnInitListener) this);
    }

 public void onInit(int status) {

  if (status == TextToSpeech.SUCCESS) {
   _langTTSavailable = mTts.setLanguage(Locale.CANADA_FRENCH); 
    if (_langTTSavailable == TextToSpeech.LANG_MISSING_DATA ||
        _langTTSavailable == TextToSpeech.LANG_NOT_SUPPORTED) {
     } else if ( _langTTSavailable >= 0) {
     } 
 }

     String Parole = Var.Reponce;
     long Duree = Long.parseLong(Var.Duree);
     mTts.speak(Parole, TextToSpeech.QUEUE_FLUSH, null);
     try {
     Thread.sleep(Duree);
     } catch (InterruptedException e){
        finish();
        e.printStackTrace();
     }

我希望通话中的两个人都能听到。用我的代码只有我可以听。变量文本是Var.reponce

0 个答案:

没有答案