4

I need to call some custom event on microphone click,How to identify when microphone is clicked?

BiswajitP
  • 233
  • 4
  • 15

2 Answers2

0

As per the doc this is not possible, you may create your own keyboard and handle it -

As soft input methods can use multiple and inventive ways of inputting text, there is no guarantee that any key press on a soft keyboard will generate a key event: this is left to the IME's discretion, and in fact sending such events is discouraged. You should never rely on receiving KeyEvents for any key on a soft input method. In particular, the default software keyboard will never send any key event to any application targetting Jelly Bean or later, and will only send events for some presses of the delete and return keys to applications targetting Ice Cream Sandwich or earlier. Be aware that other software input methods may never send key events regardless of the version.

Check this

Hope this helps.

Ashish Tamrakar
  • 810
  • 10
  • 24
0
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK ) {
// ur code to start handling voice
return true;
}
else {
super.onKeyDown(keyCode,event)
}
Roll no1
  • 1,315
  • 1
  • 16
  • 23