Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setVolumeControlStream not working when a popup window is displayed

Tags:

java

android

I have this.setVolumeControlStream(AudioManager.STREAM_MUSIC); at the start of all activities in my application so when the user presses the volume up or down buttons, he controls the media volume.

I have a popup window in my program and when that appears the user can no longer control the volume.

Looking at similar questions it seems that setting up onKeyup/down listeners can interfere with the process - but I have not set any up - the only listeners I have for the popup window are setOnClickListeners for the buttons and a setOnDismissListener for the window.

How can I fix this?

like image 639
Mick Avatar asked Mar 29 '12 12:03

Mick


1 Answers

Looks like you have to call setOwnerActivity on the Dialog object.

Documentation from the method:

Sets the Activity that owns this dialog. An example use: This Dialog will use the suggested volume control stream of the Activity.

While not tested, this should do the trick. There is also the possibility to use setVolumeControlStream.

like image 91
Luminger Avatar answered Oct 13 '22 18:10

Luminger