Intent.ACRION.view , Intent.Action.pick intent.action.get_content几个的理解
来源:互联网 发布:hilbert矩阵 matlab 编辑:程序博客网 时间:2024/05/22 13:11
1、实现调用系统音乐播放器的方法有
(1)Intent intent_music = new Intent(Intent.ACTION_PICK);
intent_music.setDataAndType(Uri.EMPTY,"vnd.android.cursor.dir/playlist");
intent_music.putExtra("withtabs", true); // 显示tab选项卡
intent_music.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent j =Intent.createChooser(intent_music, "Choose an application to open with:");
if (j == intent_music) {
startActivity(j);
} else {
Intent intent = new Intent("android.intent.action.MUSIC_PLAYER");
startActivity(intent);
}
(2)
Intent i=new Intent(Intent.ACTION_VIEW);
Uri uri=Uri.parse("file://"+audioPath);
/ /Uri uri=Uri.fromFile(filemusic);
i.setDataAndType(uri, "audio/*");
context.startActivity(i);
}
ACTION_PICK
in that here we just say what kind of data is desired, not a URI of existing data from which the user can pick. A ACTION_GET_CONTENT could allow the user to create the data as it runs (for example taking a picture or recording a sound), let them browse over the web and download the desired data, etc.(一)、调用本地联系人:
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
startActivityForResult(intent, PICK_CONTACT);
(二)、调用图库,获取所有本地图片:
Intent imageIntent = new Intent(Intent.ACTION_GET_CONTENT);
imageIntent.setType("image/*");
startActivityForResult(imageIntent, PICK_IMAGE);
(三)、调用音乐,获取所有本地音乐文件:
Intent audioIntent = new Intent(Intent.ACTION_GET_CONTENT);
audioIntent.setType("audio/*");
startActivityForResult(audioIntent, PICK_AUDIO);
(四)、调用图库,获取所有本地视频文件:
Intent videoIntent = new Intent(Intent.ACTION_GET_CONTENT);
videoIntent.setType("video/*");
startActivityForResult(videoIntent, PICK_VIDEO
3、而这里还有一个问题 就是 action.view 和 action.pick的区别 就是为什么一样可以调用这个 音乐播放器- Intent.ACRION.view , Intent.Action.pick intent.action.get_content几个的理解
- intent action
- Intent.ACTION
- Intent Action
- Intent.Action
- Intent.action
- Intent action
- Android的Intent,Action
- 常用的android intent和intent action
- Intent 一些常用的Action:
- Android的Intent Action Data
- Android Intent action 的作用
- Intent的Action属性大全
- Intent的Action、Category属性
- 理解android.intent.action.MAIN 与 android.intent.category.LAUNCHER
- 理解android.intent.action.MAIN 与 android.intent.category.LAUNCHER
- 理解android.intent.action.MAIN 与 android.intent.category.LAUNCHER
- 理解android.intent.action.MAIN 与 android.intent.category.LAUNCHER
- 主机安装ISAPI_Rewrite配置
- linux ps aux 命令详解
- POJ 2184 Cow Exhibition (体积为负时01背包的处理+问题转化)
- 17-odd-tech-interview-questions
- 移动小球
- Intent.ACRION.view , Intent.Action.pick intent.action.get_content几个的理解
- jelly文件编写-Fail to execute goal org.apache.maven.plugins
- struts2默认拦截器与自定义拦截器在使用时的注意事项
- 算了,最近重新搞android,只能把blog搬到csdn了
- 情侣相处最反感的16个情景
- Java内存泄漏
- 数据库操作中一些代码的理解
- geoserver-ows服务扩展
- "Cursor: Pin S Wait On X" Contention Mutex Sleep Reason Primarily (文档 ID 1268724.1)