如何解决音乐播放器几首歌曲同时播放 针对不同的音乐,需要设置不同的musicPath。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 恩... 现在的问题是几首不同的音乐可以同时播放,请问怎么才能在 A 音乐播放时,点击 B 音乐,正在播放的A音乐停止,改为B音乐播放。 谢谢 String oldMusicPath; if(player != null && player.isPlaying()){ if(musicPath.equal(oldMusicPath)){ player.pause(); //暂停 } else { player = new MediaPlayer(); player.setDataSource(musicPath); //musicPath为歌曲的路径 oldMusicPath=MusicPath; player.prepare(); player.start(); } return true; } String oldMusicPath; if(player != null && player.isPlaying()){ if(musicPath.equal(oldMusicPath)){ player.pause(); //暂停 } else { player.pause() player = new MediaPlayer(); player.setDataSource(musicPath); //musicPath为歌曲的路径 oldMusicPath=MusicPath; player.prepare(); player.start(); } return true; } 请问player这个对象怎么释放,使它在内存中不存在。 谢谢你这个String oldMusicPath;变量我已经解决了 求教安卓灰屏时音量下键的监听代码 求助:android下如何调用邮件系统 求教安卓按键监听 eclipse自动联想功能导致假死 基于Android的手机智能监控系统 C++调用android非静态函数 大家开发android项目都用什么框架吗? Android中如何截取surfaceView上的图像 消息推送中 androidpn的添加参数 Android Studio代码不执行变化 求教大神! 用户搜索相应资源文件
String oldMusicPath;
if(player != null && player.isPlaying()){
if(musicPath.equal(oldMusicPath)){
player.pause(); //暂停
}
else {
player = new MediaPlayer();
player.setDataSource(musicPath); //musicPath为歌曲的路径
oldMusicPath=MusicPath;
player.prepare();
player.start();
}
return true;
}
if(player != null && player.isPlaying()){
if(musicPath.equal(oldMusicPath)){
player.pause(); //暂停
}
else {
player.pause()
player = new MediaPlayer();
player.setDataSource(musicPath); //musicPath为歌曲的路径
oldMusicPath=MusicPath;
player.prepare();
player.start();
}
return true;
}
请问player这个对象怎么释放,使它在内存中不存在。
谢谢你这个String oldMusicPath;变量
我已经解决了