a1670131049 2021-05-29 22:27 采纳率: 50%
浏览 56
已结题

安卓+打开系统文件管理+指定路径

Intent intent=new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(Uri.fromFile(file), "file/*");


Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setDataAndType(Uri.fromFile(file), "file/*.*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
 E/CheckPermission: Permission Denial: can't access location pid=17422, uid=10786

上面两种写法都试过了,没有反应,根本没有调用系统文件管理器。

如果把指定路径去掉,就可以打开。要怎么样才可以指定路径打开?

报错是没有权限,可是把指定路径去掉确实可以访问到文件,权限已经添加过了。

  • 写回答

1条回答 默认 最新

  • 中考之前不改名 2021-05-31 22:07
    关注

    有root权限

    评论

报告相同问题?