好吧我終於把問題歸結爲這種方法。Java Uri.fromFile路徑問題
我有稱爲文件File對象,當我做一個toString()它輸出如下
/storage/emulated/0/Pictures/ecohelp/IMG_ecohelp_20131016_214242.jpg
現在後的文件對象被插入到以下方法
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