views:

58

answers:

1

Is it possible to register a listener to listen for changes in the volume level of the music stream in Android?

I'm displaying the actual volume in a SeekBar and I would like to change the seekbar if the user changes the volume with the hardware volume keys. At the moment the correct volume is displayed until the user changes the volume with hardware keys.

A: 

You can display the volume by accessing the current volume from AudioManger if your app is currently in focus. Otherwise, there is no concrete way (official way using api) of doing this.

ekawas
I got the current volume from the audio manager. The problem is that if the user changes the volume for example with the hardware keys my app has no way of recognizing this at the moment and the bar will display the wrong volume.
Janusz