Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding exception handler for voice recognition activity

CRs-Fixed: 395193

Change-Id: Icedba4ef192d56dfcc9918b2f8afe96b2c662fb9
  • Loading branch information...
commit a39174051ebbb56b1788cc53e528ce712682332f 1 parent 150ec13
Abhimanyu Garg authored Whitehawkx committed
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/com/android/browser/Controller.java
View
17 src/com/android/browser/Controller.java
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.