Android Audio Sound Turn mute(Context context, boolean on)

Here you can find the source of mute(Context context, boolean on)

Description

mute

Declaration

public static void mute(Context context, boolean on) 

Method Source Code

//package com.java2s;
import android.content.Context;
import android.media.AudioManager;

public class Main {
    public static void mute(Context context, boolean on) {

        AudioManager amanager = (AudioManager) context
                .getSystemService(Context.AUDIO_SERVICE);

        amanager.setStreamMute(AudioManager.STREAM_DTMF, on);
        amanager.setStreamMute(AudioManager.STREAM_NOTIFICATION, on);
        amanager.setStreamMute(AudioManager.STREAM_RING, on);
        amanager.setStreamMute(AudioManager.STREAM_SYSTEM, on);
        amanager.setStreamMute(AudioManager.STREAM_ALARM, on);
        amanager.setStreamMute(AudioManager.STREAM_MUSIC, on);
    }/*from  ww w.  ja  v  a2  s .c  o m*/
}

Related

  1. turnDown(Context context)
  2. turnPre(Context context)
  3. turnUpMost(Context context)
  4. turnUpSecond(Context context)