You need to return true when you are capturing the events public boolean onKeyDown(int keyCode, KeyEvent event) { final AudioManager audioMan = (AudioManager)getSystemService(Context.AUDIO_SERVICE); if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { // they pressed the volume down key return true; } else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { // they pressed the volume up key return true; } else { return super.onKeyDown(keyCode, event); } }
On Apr 24, 10:31 pm, mkellner <m.kin...@gmail.com> wrote: > Hello, > > I'd like to prevent the volume toast from showing up when the user > long-presses the hardware volume keys. > > Is this possible? I get the volume key events, but don't know how to > disable the system dialog from appearing. > > Thanks, > > -mk > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en