【发布时间】: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