Android examples for android.provider:Settings
set Ring Volume
import android.content.Context; import android.provider.Settings; public class Main { public static boolean setRingVolume(Context context, int ringVloume) { if (ringVloume < 0) { ringVloume = 0;// ww w. j av a 2s . c om } else if (ringVloume > 7) { ringVloume = ringVloume % 7; if (ringVloume == 0) { ringVloume = 7; } } return Settings.System.putInt(context.getContentResolver(), Settings.System.VOLUME_MUSIC, ringVloume); } }