곰돌푸우❤️

목차

    https://stackoverflow.com/a/5446346

     

    How do you get/set media volume (not ringtone volume) in Android?

    Is there a way to get/set media volume? I have tried the following: AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); int currentVolume = audio.getStreamVolume(AudioMana...

    stackoverflow.com

     

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        switch (keyCode) {
        case KeyEvent.KEYCODE_VOLUME_UP:
            audio.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                    AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI);
            return true;
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            audio.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                    AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI);
            return true;
        default:
            return false;
        }
    }
    반응형
    facebook twitter googleplus kakaostory naver