Question

In my app, I have mute button and there are some codes in onClick event:

AudioManager am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
am.setStreamMute(AudioManager.STREAM_MUSIC, true);

I expect, only mute my app but it make mute system. How I can fix it? Thanks all.

Was it helpful?

Solution

Try this out

            audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top