How to turn off all sounds on Android
<p>I'm new developing on Android. I'm have a view with a ToggleButton on it that when pushed will turn off all sound until the ToggleButton is pushed again. </p>

<p>Currently, I have this code. I can see the logging events happening, but the sound is not turning off. Can anyone provide some insight?</p>

<pre><code> public void onToggleClicked(View view) {
    Log.i("onToggleClicked", "ToggleClick Event Started");
    // Is the toggle on?
    boolean on = ((ToggleButton) view).isChecked();

    if (on) {
        Log.i("onToggleIsChecked", "ToggleClick Is On");
        //turn off sound, disable notifications
        amanager.setStreamMute(AudioManager.STREAM_SYSTEM, true);
        Log.i("STREAM_SYSTEM", "Set to true");
        //notifications
        amanager.setStreamMute(AudioManager.STREAM_NOTIFICATION, true);
        Log.i("STREAM_NOTIFICATION", "Set to true");
        //alarm
        amanager.setStreamMute(AudioManager.STREAM_ALARM, true);
        Log.i("STREAM_ALARM", "Set to true");
        //ringer
        amanager.setStreamMute(AudioManager.STREAM_RING, true);
        Log.i("STREAM_RING", "Set to true");
        //media
        amanager.setStreamMute(AudioManager.STREAM_MUSIC, true);
        Log.i("STREAM_MUSIC", "Set to true");

    } else {
        Log.i("onToggleIsChecked", "ToggleClick Is Off");
        // turn on sound, enable notifications
        amanager.setStreamMute(AudioManager.STREAM_SYSTEM, false);
        Log.i("STREAM_SYSTEM", "Set to False");
        //notifications
        amanager.setStreamMute(AudioManager.STREAM_NOTIFICATION, false);
        Log.i("STREAM_NOTIFICATION", "Set to False");
        //alarm
        amanager.setStreamMute(AudioManager.STREAM_ALARM, false);
        Log.i("STREAM_ALARM", "Set to False");
        //ringer
        amanager.setStreamMute(AudioManager.STREAM_RING, false);
        Log.i("STREAM_RING", "Set to False");
        //media
        amanager.setStreamMute(AudioManager.STREAM_MUSIC, false);
        Log.i("STREAM_MUSIC", "Set to False");
    }
    Log.i("onToggleClicked", "ToggleClick Event Ended");
}
</code></pre>

<p>Thanks in advance!</p>
