Skip to content Skip to sidebar Skip to footer

Trigger System Volume Bar

Is it possible by pressing a button in my Activity to make the volume bar appear? The volume bar is the view that appears when you press one of the hardware volume buttons. Is ther

Solution 1:

if you call setStreamVolume, pass the flag FLAG_SHOW_UI See http://developer.android.com/reference/android/media/AudioManager.html#FLAG_SHOW_UI

Solution 2:

Working code

AudioManageraudio= (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                    AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI);

Post a Comment for "Trigger System Volume Bar"