调用录音界播放音频文件
摘要:/* 播放录音文件 */private void playMusic(File file){Intent intent = new Intent();intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.setAction(android.con...
阅读全文
录音机录制声音
摘要:1、定义/* 录制的音频文件 */ private File mRecAudioFile; private File mRecAudioPath; /* MediaRecorder对象 */ private MediaRecorder mMediaRecorder; /* 录音文件列表 */...
阅读全文
用SurfaceView播放视频
摘要:1、定义private int mVideoWidth; private int mVideoHeight;private MediaPlayer mMediaPlayer; private SurfaceView mPreview; private SurfaceHolder hol...
阅读全文
使用VideoView播放视频
摘要:1、/* 创建VideoView对象 */ final VideoView videoView = (VideoView) findViewById(R.id.VideoView01);2、装载/* 设置路径 */ videoView.setVideoPath("/sdcard/test.m...
阅读全文
播放程序的音乐
摘要:1、将音乐放在应用目录“res\raw\”中2、/* 装载资源中的音乐 */ mMediaPlayer = MediaPlayer.create(Activity01.this, R.raw.test); /* 设置是否循环 */ mMediaPlayer.setLoo...
阅读全文
播放音乐
摘要:1、/* MediaPlayer对象 */ public MediaPlayer mMediaPlayer = null;/* 构建MediaPlayer对象 */mMediaPlayer= new MediaPlayer();/* 播放列表 */ private List mMusicList ...
阅读全文
使用相机和图库
摘要:1、不用权限2、启动照相机和图库 static final int TAKE_AVATAR_CAMERA_REQUEST = 1;//图库 static final int TAKE_AVATAR_GALLERY_REQUEST = 2;//照相机//启动照相机String strAvatarPro...
阅读全文
设置铃声
摘要:1、权限2、代码public void setPhoneMusic() { //设置当前文件存放音乐为手机铃声 Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); //打开系统...
阅读全文
读取网络数据流
摘要:public static void readAsFile(InputStream inStream, File file) throws Exception {//读取网络InputStream FileOutputStream outStream = new FileOutput...
阅读全文
获取网址链接 得到数据流
摘要:public InputStream getConnect(String uri) { //获取网址链接,得到数据流 InputStream is=null; try { URL myUrl=new URL(uri); //获取UR...
阅读全文
网络歌曲下载
摘要:1、权限2、代码name=etmc.getText().toString();//获取歌曲自定义名称 byte[] bname=name.getBytes(); try { name=new String(bname,"utf-8...
阅读全文
网络音乐播放
摘要:1、权限2、代码播放:new Thread(){ public void run(){ mediaPlayer=MediaPlayer.create(MainActivity.this, Uri.parse(wangZhi)); try{ URL myURL...
阅读全文