我有下面的代碼到圖像中的目錄「對myApp」PhoneGap的文件API的問題,同時節省上的目錄
function gotFileEntry(fileEntry){
var gotFileSystem = function(fileSystem) {
alert("got file Sys: " + fileSystem.name);
fileSystem.root.getDirectory("myApp", {
create : true
}, function(dataDir) {
alert("got dir :" + dataDir.fullPath);
alert("got image file entry: " + fileEntry.fullPath);
// move the file
fileEntry.moveTo(dataDir, "1.jpg", null, failFS);
}, failFS);
};
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFileSystem,failFS);
}
function SaveImage(){
// curImageURI has value of imageURI from onPhotoURISuccess()
window.resolveLocalFileSystemURI(curImageURI, gotFileEntry, failFS);
}
路徑存儲在S4上S4爲「對myApp」目錄拍攝的圖像:/存儲/模擬/ 0 /對myApp
價值curImageURI:/storage/emulated/0/Android/data/com.apps.myApp/cache/1392602140698.jpg
下面是我得到的警報:
了文件Sy S:持續
了DIR://對myApp
得到的圖像文件條目:/1392602140698.jpg
我在fileEntry.moveTo(...)得到下面的錯誤。
System.err的java.io.FileNotFoundException:源不存在
我不明白的地方,我錯了。如果有人能幫助我,我將不勝感激。 預先感謝您。
你認爲我的答案正確嗎?請檢查答案是否正確。 –