Call the Speech Recognition Activity in the system through recognizerintent. action_recognize_speech, And the recognition result is returned through onactivityresult.
Below isCode.
/** <Br/> * fire an intent to start the speech recognition activity. <br/> */<br/> private void startvoicerecognitionactivity () {<br/> intent = new intent (recognizerintent. action_recognize_speech); <br/> intent. putextra (recognizerintent. extra_language_model, <br/> recognizerintent. required age_model_free_form); <br/> intent. putextra (recognizerintent. extra_prompt, "Speech Recognition Demo"); <br/> startactivityforresult (intent, voice_recognition_request_code ); <br/>}</P> <p>/** <br/> * handle the results from the recognition activity. <br/> */<br/> @ override <br/> protected void onactivityresult (INT requestcode, int resultcode, intent data) {<br/> If (requestcode = voice_recognition_request_code & resultcode = result_ OK) {<br/> // fill the list view with the strings the recognizer thought it cocould have heard <br/> arraylist <string> matches = data. getstringarraylistextra (<br/> recognizerintent. extra_results); <br/> MList. setadapter (New arrayadapter <string> (this, android. r. layout. simple_list_item_1, <br/> matches); <br/>}</P> <p> super. onactivityresult (requestcode, resultcode, data); <br/>}