Code example for SpeechRecognizer

Methods: stopListening

0
        // If we reach this point, we failed to find a suitable recognition provider. 
        return false; 
    } 
 
    private SpeechRecognition(final Context context, int nativeSpeechRecognizerImplAndroid) {
        mContext = context;
        mContinuous = false;
        mNativeSpeechRecognizerImplAndroid = nativeSpeechRecognizerImplAndroid;
        mListener = new Listener();
        mIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
 
        if (mRecognitionProvider != null) {
            mRecognizer = SpeechRecognizer.createSpeechRecognizer(mContext, mRecognitionProvider);
        } else { 
            // It is possible to force-enable the speech recognition web platform feature (using a 
            // command-line flag) even if initialize() failed to find the PROVIDER_PACKAGE_NAME 
            // provider, in which case the first available speech recognition provider is used. 
            // Caveat: Continuous mode may not work as expected with a different provider. 
            mRecognizer = SpeechRecognizer.createSpeechRecognizer(mContext);
        }