Android: How to control volume: if volume button up, SeekBar up -
I have the following code for SeekBar :
<< setVolumeControlStream (AudioManager.STREAM_MUSIC); Final Audio Manager Audio Manager = (Audio Manager) getSystemService (reference. AUDIO_SERVICE); Int maxVolume = Audio Manager .getStreamMaxVolume (AudioManager.STREAM_MUSIC); Int Curvolum = Audio Manager .getStreamVolume (AudioManager.STREAM_MUSIC); Layout Inflight Inflator = (Layout Influenza) getSystemService (References LAOUT_INFLATER_SERVICE); See Layout = Inflator.Inflat (R.Layout.custom_dig_ag, (View Group) Find VibiBiID (RIDDialog_Root_Element)); SeekBar volControl = (SeekBar) alert.findViewById (R.id.dialog_seekbar); VolControl.setMax (maxVolume); VolControl.setProgress (curVolume); Public Zero (SeekBar ARG0) {} @StartTrackingTouch on PublicCircle (SeekBar ARG0) {} @ Override public zero while changing progress (SeekBar arg0, int arg1, Boolean arg2) {audioManager .setstreamVolume (AudioManager.STREAM_MUSIC, arg1, 0);}});
The problem is that I would like to use the User volume device button, even my SeekBar above or below
In fact, with this code I can properly control the volume with both methods (tool buttons and codes), but when I use the Volume Device button, my SeekBar is stable.
Any thoughts or suggestions?
Thank you!
You can solve this problem by reading the following problems. / P>
Hope this helps.
Comments
Post a Comment