首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Java > Android 简单播放歌曲功能演示

Android 简单播放歌曲功能演示

  • 资源大小:1.21 MB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: Android

资 源 简 介

Android 简单播放歌曲功能演示,播放本地音乐,非网络播放,可播放、暂停,运行效果如截图所示,在编写时,要注意以下代码:   int status = 1;//当前的状态,1没有声音播放 ,2 正在播放声音,3暂停   ImageButton start;//播放、暂停按钮   ImageButton stop;//停止按钮   ActivityReceiver activityReceiver;   int status = 1;//当前的状态,1没有声音播放 ,2 正在播放声音,3暂停   public void onCreate(Bundle savedInstanceState) {//重写的onCreate方法    super.onCreate(savedInstanceState);    setContentView(R.layout.main);//设置当前的用户界面    start = (ImageButton) this.findViewById(R.id.start);//得到start的引用    stop = (ImageButton) this.findViewById(R.id.stop);//得到stop按钮的引用    start.setOnClickListener(this);//为按钮添加监听    stop.setOnClickListener(this);//为按钮添加监听    activityReceiver = new ActivityReceiver();//创建BroadcastReceiver    IntentFilter filter = new IntentFilter();//创建IntentFilter过滤器    filter.addAction("wyf.ytl.update");//添加Action    registerReceiver(activityReceiver, filter);//注册监听    Intent intent = new Intent(this, MyService.class);//创建Intent    startService(intent);//启动后台Service   }

文 件 列 表

codesc.net
Player
.project
Player
Player
.classpath
codesc.net
VIP VIP
0.178366s