seek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser)
{
//Log.i("Seek Bar"开发者_如何学Python, "" + validBpm);
mp.setVolume(left, right);
}
public void onStartTrackingTouch(SeekBar seekBar)
{
left=left+20;
right=right+20;
mp.setVolume(left, right);
}
public void onStopTrackingTouch(SeekBar seekBar) {
left=left-20;
right=right-20;
mp.setVolume(left, right);
}
});
Looks like a simple fix although your original questions verbiage is really difficult to understand.
You're trying to use your own formula to set the volume and it doesn't look like those 2 methods are a good place to do it. Those two methods should only fire once, since they are only a startTouch or finishTouch.
You need to be using the "progress" integer provided from the onProgressChanged method to set the volume to the mediaplayer accordingly. This integer is the value of where the user set the seekBar.
精彩评论