code is as follows:
private final class AlarmSeekBarChangeListener implements OnSeekBarChangeListener{
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Auto-generated method stub
switch(seekBar.getId()){
case R.id.hours_sb:
hoursProgress.setText(String.valueOf(progress));
break;
case R.id.minutes_sb:
minutesProgress.setText(String.valueOf(progress));
break;
case R.id.volume_sb:
// Unreasonable above, mainly depending on the following
// Get the URI of the default alarm of the system
Uri alert = randoneManager.getdefaulturi (rightoneManager.type_alarm);
// Get a Ringtone object according to URI
Raingtone raing = RingtoneManager.get)
// Set the attribute of the alarm. The setting is set as an alarm clock here, which determines that when the bell is ringing, it is based on the sound of that type
Ring.setStreamType (Audiomanager.stream_alarm);
// Whenever the drag bar changes, set the alarm ringtone to the value after the change
AMANAGER.setStreamVolume (Audiomanager.Stream_alarm, Progress, 0);
// Play the alarm
raing.play ();
Break;
}
}
Add it. Before dragging Seekbar, you should set a variable to save the value of the volume of the previous system volume. When the operation is canceled, then restore the value back.