1

I already used below code for sound mute in my audio player.

((Activity)mActivity).getAudioManager().setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0);

Now I need to know how to set unmute and set before volume level.

1 Answers1

0

The code you shared above is actually used to change stream volume. The second parameter of setStreamVolume() is value of volume.

To set volume to full

((Activity)mActivity).getAudioManager().setStreamVolume(AudioManager.STREAM_MUSIC, 20, 0);

The volume can be changed by changing the index value between 0 and 20

Saad Tariq
  • 26
  • 3