如何从我的应用程序启动默认音乐播放器? [英] How to start the default music player from my app?
本文介绍了如何从我的应用程序启动默认音乐播放器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 ListView
制作了一个应用程序.当我点击 ListView
项目时,.ogg
声音文件应该开始播放.不是在我的应用程序中,而是在用户的默认音乐播放器应用程序中.我该怎么做?
I make a app with a ListView
. When I tap on a ListView
item, a .ogg
soundfile should start playing. Not in my app, but in the default music player app of the user. How can I do this?
推荐答案
试试这个:
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File(uri);
intent.setDataAndType(Uri.fromFile(file), "audio/*");
ActivityChatView.mContext.startActivity(intent);
这篇关于如何从我的应用程序启动默认音乐播放器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文