android调用系统自带的文件管理程序选择文件

来源:互联网 发布:能看网络电视的电视机 编辑:程序博客网 时间:2024/05/22 15:55
需求是在上传文件时,我们要选择SD卡中或者手机中的文件;
现在想通过点击上传时调用系统自带的文件管理器选择文件;
在onActivityResult函数中监听返回的文件集合,请求大神们教一下小弟如何调用系统的文件夹


我现在是这样写都没有作用,只能在图库中选择
                Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/");
//intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
try {
startActivityForResult(Intent.createChooser(intent, "请选择一个要上传的文件"),
1);
} catch (android.content.ActivityNotFoundException ex) {
// Potentially direct the user to the Market with a Dialog
Toast.makeText(this, "请安装文件管理器", Toast.LENGTH_SHORT)
.show();
}
setType两个都试了都不行。
0 0
原创粉丝点击