【发布时间】:2016-06-18 06:16:14
【问题描述】:
我正在尝试使用意图打开图像。 图片在我的存储中的路径是/storage/emulated/0/nitp/download/logo.png。
我的代码是
Intent intent = new Intent();
intent.setAction(Intent.ACTION_DEFAULT);
intent.setDataandType(Uri.parse("/storage/emulated/0/nitp/download/logo.png"),"image/*");
startActivity(intent);
我也试过把 file://storage/emulated/0/nitp/download/logo.png 和 content://storage/emulated/0/nitp/download/logo.png
我应该使用什么路径?
已解决 必须使用 file:///storage/emulated/0/nitp/downloads/logo.png
【问题讨论】:
-
它提示“选择应用程序”对话框,但我选择的应用程序没有打开。它立即关闭,我再次进入我的应用活动
-
你在调用
startActivity后在logcat上看到了什么? -
还有
adb shell ls -l /storage/emulated/0/nitp/download/logo.png的输出是什么? -
当我尝试添加 shell ls storage/emulated/0/nitp/downloads 时,它说没有这样的目录。但相反,它显示该目录是 /storage/sdcard0/nitp/downloads。