如何使用Intent.ACTION_VIEW查看文件夹的内容?

Jev*_*rlo 5 android sd-card android-manifest android-intent

我正在尝试使用意图查看特定文件夹中的图像。我的代码如下:

Intent intent = new Intent();  
intent.setAction(Intent.ACTION_VIEW);  
Uri imgUri = Uri.parse("file://sdcard/download");  
intent.setDataAndType(imgUri, "image/*");  
startActivity(intent);  
Run Code Online (Sandbox Code Playgroud)

但是,每次运行时,我都会在日志中收到此消息:

02-25 00:40:16.271:错误/(8359):无法打开'/下载
'02-25 00:40:16.271:错误/(8359):无法打开'/下载'

我究竟做错了什么?

小智 1

我认为这比其他人建议的要简单得多。我相信路径区分大小写。在您的示例中,“file://sdcard/Download”应该有效。