zoukankan      html  css  js  c++  java
  • 1600802125

    Android第三次作业

    1.界面截图

    2.关键代码

    2.1设置音乐播放器的播放进度

        private static SeekBar sb;
    
        private static TextView tv_progress;
        private static TextView tv_total;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            tv_progress = (TextView) findViewById(R.id.tv_progress);
            tv_total = (TextView) findViewById(R.id.tv_total);

    2.2添加接口的控制类

        class MusicControl extends Binder implements MusicInterface {
            @Override
            public void play() {
                MusicService.this.play();
            }
            @Override
            public void pausePlay() {
                MusicService.this.pausePlay();
            }
            @Override
            public void continuePlay() {
                MusicService.this.continuePlay();
            }
            @Override
            public void seekTo(int progress) {
                MusicService.this.seekTo(progress);
            }
        } 

    2.3播放

        public void play() {
    
            try {
    
                if(player == null)
                {
                    player = new MediaPlayer();
                }  

    2.4暂停

        public void pausePlay() {
    
            player.pause();
        }

    上一首及下一首功能暂未实现

    3.代码链接:  https://git.coding.net/mql1234/music.git

    4.APK链接:待定



  • 相关阅读:
    this指针是什么?
    C++多态实现原理
    面试题2:实现Singleton模式
    面试题1:赋值运算符函数
    1.Two Sum
    朴素贝叶斯
    K近邻法
    感知机
    数据类型、用户交互、赋值运算
    蓝牙技术概述
  • 原文地址:https://www.cnblogs.com/mql675/p/10104448.html
Copyright © 2011-2022 走看看