You can get the current volume of media player with the help of Audiomanager class.The code is as follows:-
AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE);
int volume_level= am.getStreamVolume(AudioManager.STREAM_MUSIC);
Similarly,if you want to set the default volume of media player.You can do that like as:-
am.setStreamVolume(
AudioManager.STREAM_MUSIC,
volume_level,
0);
That's all..Happy coding :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…