您的位置:首页 > 移动开发 > Android开发

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

2016-12-31 06:50 615 查看
需求是在上传文件时,我们要选择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两个都试了都不行。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: