Android 第三次作业

 

 

一、界面截图

  

二、主要代码

  音乐播放与切换

 1 public void onClick(View v){
 2 
 3 if(v.getId() == R.id.index_control){
 4 if (!mediaPlayer.isPlaying()){
 5 mediaPlayer.start();
 6 if(!animation.isStarted()){
 7 animation.start();
 8 }
 9 animation.resume();
10 }
11 else if(mediaPlayer.isPlaying()){
12 mediaPlayer.pause();
13 animation.pause();
14 }
15 }
16 
17 
18 if(v.getId() == R.id.index_lastmusic){
19 mediaPlayer.reset();
20 if(CONTROL == 0){
21 CONTROL = 2;
22 initMediaPlayer();
23 mediaPlayer.start();
24 }
25 else {
26 CONTROL--;
27 initMediaPlayer();
28 mediaPlayer.start();
29 }
30 }
31 else if(v.getId() == R.id.index_nextmusic){
32 mediaPlayer.reset();
33 if(CONTROL == 2){
34 CONTROL = 0;
35 initMediaPlayer();
36 mediaPlayer.start();
37 }
38 else {
39 CONTROL++;
40 initMediaPlayer();
41 mediaPlayer.start();
42 }
43 }
44 }

 

三、APK下载链接

  https://pan.baidu.com/s/1mF1kQpRGH5msiF9X1i04rg

四、项目链接

  https://coding.net/u/ICESTAR9527/p/MusicPlayer/git

posted @ 2018-12-11 21:59  水水月  阅读(241)  评论(0编辑  收藏  举报