Why I am not able to control Media volume when the alert dialog is shown in Android?
<p>I am controlling  media volume programmatically from my app. I am setting alert dialog when the media volume is below certain range. When this alert is displayed at this point if I try to adjust the volume controller buttons the ringer volume will get adjusted not media volume.
Why is this happening?</p>

<p>I am using these lines to control media volume..</p>

<pre><code>case KeyEvent.KEYCODE_VOLUME_DOWN:

             audio.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                    AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI);
             return true;
case KeyEvent.KEYCODE_VOLUME_UP:

             audio.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                    AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI);

             return true;
</code></pre>

<p>Once the alert dialog is dismissed I am able to control the media volume.
I am facing this issue only in phone not in tablet.</p>
