반응형
Notice
Recent Posts
Recent Comments
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Archives
Today
Total
관리 메뉴

Do Something IT

[안드로이드] SeekBar로 사운드 조절하기 본문

Android

[안드로이드] SeekBar로 사운드 조절하기

아낙시만더 2010. 12. 20. 13:52
반응형


public void setSeekBar() {
  /* 미디어 볼륨 조절 하는바 */
  seekVolumn = (SeekBar) findViewById(R.id.mp_seekbar_volumn);
  audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
  nMax = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
  nCurrentVolumn = audioManager
    .getStreamVolume(AudioManager.STREAM_MUSIC);

  seekVolumn.setMax(nMax);
  seekVolumn.setProgress(nCurrentVolumn);

  seekVolumn.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
   public void onStopTrackingTouch(SeekBar seekBar) {
   }

   public void onStartTrackingTouch(SeekBar seekBar) {
   }

   public void onProgressChanged(SeekBar seekBar, int progress,
     boolean fromUser) {
    audioManager.setStreamVolume(AudioManager.STREAM_MUSIC,
      progress, 0);
   }
  });
 }

반응형
Comments