質問

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.

役に立ちましたか?

解決

Try this out

            audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top