【发布时间】:2013-10-25 02:54:02
【问题描述】:
好的,我终于把问题归结为这个方法了。
我有一个名为 file 的 File 对象,当我执行 toString() 时,它会输出以下内容
/storage/emulated/0/Pictures/ecohelp/IMG_ecohelp_20131016_214242.jpg
现在将File对象插入到下面的方法中
Uri uriFile = Uri.fromFile(file);
当我执行 uriFile.toString() 时,它会输出以下内容
file:///storage/emulated/0/Pictures/ecohelp/IMG_ecohelp_20131016_214242.jpg
现在我尝试删除“/storage...”开头的/,但它仍然不起作用,有人知道为什么会这样吗?它应该是 file:// 和其他任何东西一样,但它包含其中三个。
我试图为图像模仿这个:http://developer.android.com/guide/topics/media/camera.html#saving-media
尝试保存文件时出现此错误:
10-16 22:16:39.945: E/AndroidRuntime(32080): java.lang.RuntimeException:
Failure delivering result ResultInfo{who=android:fragment:2, request=100,
result=-1, data=null} to activity
{com.example.ecohelp/com.example.ecohelp.MainActivity}: java.lang.NullPointerException
【问题讨论】: