2011-8-13 1:18:23
来源:互联网 发布:16级研究所升级数据 编辑:程序博客网 时间:2024/04/30 05:46
2011-8-13 1:18:23
In android, we can play the audio file from the resource.
How to do it ?
Step1:- In your project , create a folder named with 'raw' in res folder (res --- > raw). In that folder copy any mp3 file to play.
Step 2:-
Edit your Java class file
[sourcecode language="java"]
public class MediaPlayerExample extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MediaPlayer mPlayer = MediaPlayer.create(this, R.raw.test_cbr);
mPlayer.start();
}
}
[/sourcecode]
Now Run the Application.
After the application starts , the media player will starts automatically and song will be played. To stop playing the song use mPlayer.stop();
- 2011-8-13 1:18:23
- 2011-8-9 19:13:18
- 2011-8-1 20:18:46
- 2011-8-1 21:13:48
- 2011-8-23
- 13/8/18 周赛
- 13-01-23-->8
- 2011-1-18
- 2011-1-17,2011-1-23
- 2011-8-13 16:13:41
- 2011-8-8 18:48:31
- 2011-9-18 13:46:09
- 2011-9-23 12:05:13
- 2011-8-8 13:07:20
- 1 2 3 6 7 8 11 12 13 16 17 18 21 22 23 要求1、 123报数,取出数3的 数; 2、将上次取出的数,再次123报数,取出
- 2011 1-8
- 2011-12-13_<1>
- 2011-8-6 18:04:28
- 2011年网上购书清单
- Android之操作通讯录数据ContentProvider
- Ubuntu下快速建立ssh服务
- 数据库规范化
- C#集合接口与BitArray
- 2011-8-13 1:18:23
- Java 将数据处理成 PDF 、Excel、Word格式
- 2011-8-13 16:13:41
- Minimize The Difference
- C#程序集Assembly
- fieldset在不同浏览器中的差异
- ubuntu 安装tar.gz包
- Handler 之 预约时间功能
- Ubuntu 3D桌面特效的详细设置