I am following this youtube video right here: https://www.youtube.com/watch?v=VazSEtXHDcI
I am trying to implement google voice recognition into my application. I am using the code from that video.
After implementing this code, the google dialog box should pop up and prompt me with voice recognition:
ButtonSpeech.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
// Specify free form input
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT,"Please start speaking");
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.ENGLISH);
startActivityForResult(intent,1);
}
});
But it doesn't. When i try to click the button 'ButtonSpeech', my app will run into an error and terminate.
I can't figure out why. I am using the same code, exactly like the guy in the video.