Android Headset buttons
My HTC headset has 3 buttons. Next/Pause/Previous.
I can emulate the pause button in my code by call开发者_运维百科ing ACTION_MEDIA_BUTTON.
How can i emulate The Next and the Previous button?
Thanks!
Use ACTION_MEDIA_BUTTON
. There is an EXTRA_KEY_EVENT
that holds a KeyEvent
tied to which specific media button was pressed. KEYCODE_MEDIA_NEXT
and KEYCODE_MEDIA_PREVIOUS
are likely candidates to map to your particular buttons, but you may have to experiment.
精彩评论