2017-01-22 40 views
1

アンドロイドウェアデバイスでText to Speech APIを実行できますか?私はそれをしようとしていますが、それは動作していません。android wearでAndroid Text to Speechを実行していますか?

時計には単語を含むカードのリストが表示され、クリックするとボタンが表示され、ユーザーは現在のカードの単語を聞くことができます。

私は携帯電話で作業していますが、私の目的はAndroidの時計で動作させることです。

何か助けていただければ幸いです。おかげさまで

答えて

1

あなたは声は、あなたがこの実装を使用することができ、あなたのウェアラブルデバイス用のコマンドを使用したい場合:

private static final int SPEECH_REQUEST_CODE = 0; 

// Create an intent that can start the Speech Recognizer activity 
private void displaySpeechRecognizer() { 
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); 
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, 
      RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); 
// Start the activity, the intent will be populated with the speech text 
    startActivityForResult(intent, SPEECH_REQUEST_CODE); 
} 

// This callback is invoked when the Speech Recognizer returns. 
// This is where you process the intent and extract the speech text from the intent. 
@Override 
protected void onActivityResult(int requestCode, int resultCode, 
     Intent data) { 
    if (requestCode == SPEECH_REQUEST_CODE && resultCode == RESULT_OK) { 
     List<String> results = data.getStringArrayListExtra(
       RecognizerIntent.EXTRA_RESULTS); 
     String spokenText = results.get(0); 
     // Do something with spokenText 
    } 
    super.onActivityResult(requestCode, resultCode, data); 
} 

https://developer.android.com/training/wearables/apps/voice.html

+0

カード内のテキストを音声コマンドではなく読みたいと思っています。私は質問に詳細を追加しました。 –

1

のAndroid 2.0を着用し、これは組み込まれてい - 音声出力端子に設定-Accessibility-テキストの下で。したがって、現在HuaweiまたはUrbane 2をお持ちでない場合、メインリリースは2月9日または10日にわずか数週間で噂されています。

関連する問題