Java tutorial
//package com.java2s; import android.content.Context; import android.media.AudioManager; public class Main { public static void setRingerMode(Context mContext, int x) { AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); switch (x) { case 0: am.setRingerMode(AudioManager.RINGER_MODE_SILENT); break; case 1: am.setRingerMode(AudioManager.RINGER_MODE_VIBRATE); break; case 2: am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); break; /*case 3: am.setRingerMode(AudioManager.RINGER_MODE_); break;*/ } } }