Making the device speak text on command
<p>I am having difficulty in framing this question but anyways here it goes, I have made two applications basically the TextToSpeech app and the SpeechToText application. They are working fine, now I am trying to merge them. Basically I want the the text to speech part to say the text entered in a text field , only if the user says the word "speak".That would be done using the speech to text part. Now the problem I am having is that android displays a list of outputs when the user says something, but I only one output that is "Speak" . How can I get only one output instead of a list.</p>

<p>Initially the app becomes active on button click.</p>

<p>The code I am trying is as follows:</p>

<pre><code>@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    i.putExtra(RecognizerIntent.EXTRA_PROMPT, "system Activated");
    startActivityForResult(i, check);

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub

    if (requestCode == check &amp;&amp; resultCode == RESULT_OK) {
        String command = data
            .getStringExtra(RecognizerIntent.EXTRA_RESULTS).toString();
        if (command.equals(command_verify)) {
            speak();
        } else
            finish();
    }

    super.onActivityResult(requestCode, resultCode, data);
}

public void speak() {
    String text_to_speak = message_field.getText().toString();
    talk.speak(text_to_speak, TextToSpeech.QUEUE_FLUSH, null);
}
</code></pre>
