本帖最后由 ameyume 于 2010-09-07 21:37:15 编辑

解决方案 »

  1.   

    多谢楼上,搞定
    要用AudioManager.STREAM_MUSIC,不能用AudioManager.STREAM_RING
    } else if (v == mVolumeDecrease) {
    int index = mAM.getStreamVolume(AudioManager.STREAM_MUSIC) - 1;
    if (index < 0) {
    index = 0;
    }
    Log.i(TAG, "index = " + index);
    mAM.setStreamVolume(AudioManager.STREAM_MUSIC, index, 0);
    mVolume = mAM.getStreamVolume(AudioManager.STREAM_MUSIC); 
    Log.i(TAG, "down volume is " + mVolume);
    mProgressBarVolume.setProgress(mVolume);
    } else if (v == mVolumeIncrease) {
    int index = mAM.getStreamVolume(AudioManager.STREAM_MUSIC) + 1;
    int maxIndex = mAM.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    if (index > maxIndex) {
    index = maxIndex;
    }
    Log.i(TAG, "index = " + index + ", maxIndex = " + maxIndex);
    mAM.setStreamVolume(AudioManager.STREAM_MUSIC, index, 0);
    mVolume = mAM.getStreamVolume(AudioManager.STREAM_MUSIC); 
    Log.i(TAG, "up volume is " + mVolume);
    mProgressBarVolume.setProgress(mVolume);
    }
      

  2.   

    STREAM_MUSIC 没用过这个方法
    学习了