Implementation method of speech recognition for Android programming

This paper describes the implementation method of speech recognition in Android programming. Share with you for your reference, as follows:

Speech recognition technology is widely used in mobile phones. The most frequent way of human communication is speech. In mobile phone applications, most of them are manually input through hardware. At present, this is still the main way to interact with mobile phones. However, with the continuous improvement of mobile phone software and hardware functions, it can be predicted that voice communication will be the main way of human-computer interaction in the near future. Siri voice assistant built into iPhone is a good example. Little known is that its speech recognition technology comes from Google. As you know, Android, which is pushed by Google, has naturally been implanted with the core voice recognition technology. It also integrates Google's cloud technology to better realize man-machine voice interaction.

Android mainly realizes speech recognition through recognizerintent, which mainly includes some constants to represent the mode of speech, as shown in the following table:

Of course, if the setting is not found, an activitynotfoundexception will be thrown, so we need to catch this exception. In the following example, we implemented a simple speech recognition program. When we click the "click to use speech recognition" button, we start speech, and then get the results in the onactivityresult method and display them. If the current mobile phone is not connected to the Internet, the connection problem will be displayed. The operation effect is as follows:

After clicking the button:

If there is no networking, a connection error will occur:

After saying the word "computer" to the microphone:

The specific implementation code is as follows:

For more Android related content, readers who are interested can view the special topics of this site: summary of Android multimedia operation skills (audio, video, recording, etc.), introduction and advanced tutorial of Android development, summary of Android view skills, summary of activity operation skills of Android programming, summary of skills of operating SQLite database for Android Summary of Android operating JSON format data skills, summary of Android database operating skills, summary of Android file operating skills, summary of SD card operating methods for Android programming development, summary of Android resource operating skills and summary of Android control usage

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>