Android examples for android.media:Media
set Media Volume
import android.content.Context; import android.provider.Settings; public class Main { public static boolean setMediaVolume(Context context, int mediaVloume) { if (mediaVloume < 0) { mediaVloume = 0;//w w w . jav a 2 s . com } else if (mediaVloume > 15) { mediaVloume = mediaVloume % 15; if (mediaVloume == 0) { mediaVloume = 15; } } return Settings.System.putInt(context.getContentResolver(), Settings.System.VOLUME_MUSIC, mediaVloume); } }