Android: Hide volume control panel from device?

Is there a way to hide the volume change panel / notification (however you can call it .. btw. What do you call it?)?

screenshot nexus on volume change

i attached the screenshot above. this bar is displayed every time I change the volume (at least on my test device). or is it a special connection?

+5
source share
1 answer

, . , . , . KeyEvent.KEYCODE_VOLUME_UP/DOWN, . , . , , .

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (event.getKeyCode()) {
        case KeyEvent.KEYCODE_VOLUME_UP:
            manager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                    AudioManager.ADJUST_RAISE,
                    AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
            return true;
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            manager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                    AudioManager.ADJUST_LOWER,
                    AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
            return true;

        default:
            return super.onKeyDown(keyCode, event);
    }
}

AudioManager

manager = (AudioManager) context
            .getSystemService(Context.AUDIO_SERVICE);
+15

All Articles