Skip to content

Commit

Permalink
Adding exception handler for voice recognition activity
Browse files Browse the repository at this point in the history
CRs-Fixed: 395193

Change-Id: Icedba4ef192d56dfcc9918b2f8afe96b2c662fb9
  • Loading branch information
Abhimanyu Garg authored and Whitehawkx committed Sep 12, 2012
1 parent 150ec13 commit a391740
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/com/android/browser/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -2906,11 +2906,18 @@ public boolean supportsVoice() {

@Override
public void startVoiceRecognizer() {
Intent voice = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
voice.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
voice.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);
mActivity.startActivityForResult(voice, VOICE_RESULT);
try{
Intent voice = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
voice.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
voice.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);
mActivity.startActivityForResult(voice, VOICE_RESULT);
}
catch(android.content.ActivityNotFoundException ex)
{
//if could not find the Activity
Log.e(LOGTAG, "Could not start voice recognizer activity");
}
}

@Override
Expand Down

0 comments on commit a391740

Please sign in to comment.