From d62ce4c42fee9316462dd397fb0ebc0ac86d7a70 Mon Sep 17 00:00:00 2001 From: Abhimanyu Garg Date: Tue, 4 Sep 2012 01:42:25 -0700 Subject: Adding exception handler for voice recognition activity CRs-Fixed: 395193 Change-Id: Icedba4ef192d56dfcc9918b2f8afe96b2c662fb9 --- src/com/android/browser/Controller.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index 3a68f4b..ebc2c90 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -2768,11 +2768,15 @@ public class Controller @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) { + Log.e(LOGTAG, "Could not start voice recognizer activity"); + } } @Override -- cgit v1.1