2011-07-18 18 views
3

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

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中写一些代码吗?

感谢您的帮助。

+2

您的URI不完整。这就是为什么android无法找到要打开的活动。 – Suchi

+0

已解决的问题 - 我用ACTION_GET_CONTENT和intent.setType(“file/*”)试试这个,它的功能非常完美:) – west44

回答

0

您可以使用此操作浏览文件。

Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 
    intent.setType("file/*"); 
    startActivity(intent); 
相关问题