Frage

I am working in an android app and I need to make an optionMenu with an option to disable/enable the sounds in the app.

Is it possible in android have full control over the volume of the app? Is there any method that could do that? Must I do this with code?

Thanks

War es hilfreich?

Lösung

You can find useful information here. According to that answer, it's not possible. Just don't play the sounds.

Andere Tipps

By using AudioManager you can get current volume level and max volume level. At the time of button click/ option select you can control the volume level also. Here is the code.I hope this will help you to set volume.

AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
int curVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);

To Set Volume

audioManager.setStreamVolume(AudioManager.STREAM_MUSIC,vol_level, 0);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top