Java tutorial
//package com.java2s; import android.content.Context; import android.media.AudioManager; public class Main { public static void setRingVolume(Context context, int ringVloume) { if (ringVloume < 0) { ringVloume = 0; } else if (ringVloume > 7) { ringVloume = ringVloume % 7; if (ringVloume == 0) { ringVloume = 7; } } ((AudioManager) context.getSystemService(Context.AUDIO_SERVICE)).setStreamVolume(AudioManager.STREAM_RING, ringVloume, AudioManager.FLAG_PLAY_SOUND); } }