问题描述
在我的应用程序,我需要推出的Android音乐播放器。而且,就目前来看,它完美的作品:
In my application, I need to launch the Android Music Player. And, for now, it works perfectly :
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
File file = new File(file_path);
intent.setDataAndType(Uri.fromFile(file), "audio/*");
startActivity(Intent.createChooser(intent, "..."));
但是用户不能使用的下一个和preV按钮切换音乐。这就是为什么我尝试一次(播放列表)推出多首歌曲。我真的不知道如何做到这一点!
给出一个数组的意图是什么?
But the user can't use the "next" and "prev" buttons to switch music. That's why I try to launch multiple songs at once (a playlist). And I don't really know how to do this!Give an array to the intent ?
推荐答案
据我所知是没有办法启动多个曲目。但是你可以实现你的播放器,使用的MediaPlayer类。这也并不支持多音轨。所以,你也可以做一个服务,使用OnCompletionListener听曲目时结束,开始下一首曲目。
As far I know there is no way to launch multiple tracks. But you can implement your player, using the MediaPlayer class. Which also doesn't supports multiple tracks. So you also have to make a service, use OnCompletionListener to listen when tracks finish, to start the next track.
这线程将有所帮助:
How做Android的mediaplayers继续播放歌曲时,应用程序被关闭?
还有这个:
Start默认的音乐播放器,音乐播放默认
这篇关于播放多首歌曲与Android的意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!