i used this code to adjust volume but it didn’t work
int volume=23;
audio.setStreamVolume(AudioManager.STREAM_RING,volume, AudioManager.FLAG_PLAY_SOUND|AudioManager.FLAG_ALLOW_RINGER_MODES);}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you should not just set the volume to 23 instead you should first make a call to getStreamMaxVolume(StreamType) to get the max volume possible for the StreamType which in this case is the ringer’s volume.
for example, to set the ringer’s volume to max you do this!
UPDATES
ok. now that i am at home i can try out codes. here as you can see, streamMaxVolume gives me a integer of 7. if you try to set it to 23 its way too much. so the possible values you can use in setStreamVolume in my case is
0, 1, 2, 3, 4, 5, 6, 7
Lowest <—–> Highest