进度条:
Runnable start = new Runnable()
{
@Override
public void run()
{
// TODO Auto-generated method stub
mp.start(); // start mediaplayer
handler.post(updatesb);
//use a handler to update SeekBar
}
};
Runnable updatesb = new Runnable()
{
@Override
public void run()
{
// TODO Auto-generated method stub
SeekBar1.setProgress(mp.getCurrentPosition());
handler.postDelayed(updatesb, 100);
}
};
然后用handler.post(start)启动播放器。
静音:
btnMute.setOnClickListener(new Button.OnClickListener()
{
@Override
public void onClick(View v)
{
//System.out.println("Button Mute");
if (SoundEnabled)
{
audioManager.setStreamMute(AudioManager.STREAM_MUSIC , true);
btnMute.setText(" Unmute ");
}
else
{
audioManager.setStreamMute(AudioManager.STREAM_MUSIC , false);
btnMute.setText(" Mute ");
}
SoundEnabled = !SoundEnabled;
}
}); // btnMute onClick ends
没有评论:
发表评论