使用Android的意图启动音乐播放器 [英] Android launching music player using intent

查看:166
本文介绍了使用Android的意图启动音乐播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在Android开放,从我的应用程序的音乐应用程序,或者是它最好写我的里面一个全新的音乐应用程序。我宁愿使用他们,因为用户已经熟悉了。

Is it possible to open the music app from my app in android, or is it best to write a whole new music app inside of mine. I would rather use theirs since the user will already be comfortable with it.

推荐答案

我发现做到这一点的方法之一。

I found one way to do this.

Intent intent = new Intent();  
intent.setAction(android.content.Intent.ACTION_VIEW);  
File file = new File(YOUR_SONG_URI);  
intent.setDataAndType(Uri.fromFile(file), "audio/*");  
startActivity(intent);

这篇关于使用Android的意图启动音乐播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆