Example usage for android.media AudioManager FLAG_ALLOW_RINGER_MODES

List of usage examples for android.media AudioManager FLAG_ALLOW_RINGER_MODES

Introduction

In this page you can find the example usage for android.media AudioManager FLAG_ALLOW_RINGER_MODES.

Prototype

int FLAG_ALLOW_RINGER_MODES

To view the source code for android.media AudioManager FLAG_ALLOW_RINGER_MODES.

Click Source Link

Document

Whether to include ringer modes as possible options when changing volume.

Usage

From source file:com.pixate.freestyle.fragment.ButtonsFragment.java

/** Set the volumn controling to seek bar */
private void setSeekBar(SeekBar seek) {
    AudioManager audioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
    seek.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_RING));
    seek.setProgress(m_nAlarmVolum);//from   w  ww . j  a  v a2  s  .co  m
    seek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar arg0) {

        }

        @Override
        public void onStartTrackingTouch(SeekBar arg0) {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean arg2) {
            m_nAlarmVolum = progress;

            AudioManager audioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
            audioManager.setStreamVolume(AudioManager.STREAM_RING, m_nAlarmVolum,
                    AudioManager.FLAG_ALLOW_RINGER_MODES | AudioManager.FLAG_PLAY_SOUND);
        }
    });
}