【问题标题】:Implicite Intent which open file manager打开文件管理器的隐式意图
【发布时间】:2011-07-18 18:02:31
【问题描述】:

我的问题很简单。我想用这种方法在我的活动中打开随机文件管理器:

private void openFile() {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("file://"));
    startActivity(intent);
}

但它不起作用。每次我得到这个错误:

ERROR/AndroidRuntime(9107): android.content.ActivityNotFoundException: No Activity found to handle Intent...

怎么了?有必要在AndroidManifest中写一段代码吗?

感谢您的帮助。

【问题讨论】:

  • 您的 URI 不完整。这就是为什么 android 找不到要打开的活动。
  • 问题已解决 - 我尝试使用 ACTION_GET_CONTENT 和 intent.setType("file/*") 并且效果很好 :)

标签: android file android-intent


【解决方案1】:

您使用此操作来浏览文件。

   Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
   intent.setType("file/*");
   startActivity(intent);

【讨论】:

    猜你喜欢
    • 2018-04-19
    • 2019-08-15
    • 1970-01-01
    • 2021-06-06
    • 1970-01-01
    • 2015-05-10
    • 2012-02-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多