mute Audio player - Android Media

Android examples for Media:Auto Player

Description

mute Audio player

Demo 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);
    }//  w  w  w . j  a v a2  s  .  c o  m
}

Related Tutorials