NotificationBar的实现代码参考,上代码:
public class MusicService extends Service implements MediaPlayer.OnCompletionListener {
private static final boolean D = true;
private static final String TAG = MusicService.class.getSimpleName();
private static final int HANDLER_MUSIC_PLAY = 1;
private MediaPlayer mMediaPlayer;
private MusicHandler mMusicHandler;
public MusicService() {
}
@Override
public void onCreate() {
super.onCreate();
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setOnCompletionListener(this);
HandlerThread thread = new HandlerThread("music",Thread.NORM_PRIORITY);
thread.start();
Looper looper = thread.getLooper();
mMusicHandler = new MusicHandle