Code example for SpeechRecognizer

Methods: cancel

0
 
	/** 
	 * Stops listening and throws away the results. 
	 */ 
	public void cancelListening() { 
		speechRecognizer.cancel();
		onListeningStopped(); 
	} 
 
	private Intent makeIntent() {
		Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
		intent = intent.setClassName("com.google.android.voicesearch",
				"com.google.android.voicesearch.RecognitionService"); 
		intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
				RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
//		intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, 
//				RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH); 
		intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
		// intent.putExtra(EXTRA_RECOGNITION_CONTEXT, this.getBundle()); 
		intent.putExtra(EXTRA_CALLING_PACKAGE, "VoiceIME");
		return intent;