I want to trigger an additional event in an android app when the default speech recognition button is touched on the android soft-keyboard. Is there any method catching this event, or what is the code for the speech recognition button to modify the keyboard.xml directly? Any solution would be appreciated, thanks.
Asked
Active
Viewed 463 times
1 Answers
2
None. Software keyboards don't generate keyboard events. They send text via InputConnection.commiteTexzt. For a button that causes no text like speech, it would internally launch a speech recognition app, either the default one or one of their choosing.
If you're looking to implement a basic keyboard yourself, just have the key launch an intent with action RecognizerIntent.ACTION_RECOGNIZE_SPEECH. If you want something fancier you pretty much have to bind with a specific voice recognition library directly.

Gabe Sechan
- 90,003
- 9
- 87
- 127
-
1Is there a way to inherint from the default speech recognizer button in the default keyboard so that no RecognizerIntent.ACTION_RECOGNIZE_SPEECH needs to be implemented again? Also I would like to use the default speech-recognition key design. – user2212461 Jul 15 '14 at 08:13
-
2Inherit from no. But the default keyboard is open sourced- it's called the latinime in the AOSP. You can look there to see exactly what it's doing. – Gabe Sechan Jul 15 '14 at 14:40