0
我是phonegap和android的新手......任何人都可以幫助我從目錄中檢索文件名列表...我查看了phonegap的所有文檔,但沒有任何描述我的問題...Android-Phoengap-如何從本地存儲獲取文件名?
我是phonegap和android的新手......任何人都可以幫助我從目錄中檢索文件名列表...我查看了phonegap的所有文檔,但沒有任何描述我的問題...Android-Phoengap-如何從本地存儲獲取文件名?
猜猜你需要這個。
gotLocalFileSystem : function(fileSystem){
fileSystem.root.getDirectory(Android/data/com.example.example, {create: false, exclusive: false}, getRootDirSuccess, fail);
},
getRootDirSuccess: function(dirEntry) {
// Get a directory reader
var directoryReader = dirEntry.createReader();
// Get a list of all the entries in the directory
directoryReader.readEntries(dirReadSuccess,fail);
},
dirReadSuccess: function(entries) {
if(entries.length > 0){
console.log(" No of files Root Directory have : "+entries.length);
for (i=0; i<entries.length; i++) {
if(entries[i].isDirectory) {
var aDirName = entries[i].name; // this will give the entries name
console.log("Entries"+aDirName);
}
}
}else{
console.log("Empty Root Directory ");
isEmptyRootDir = true;
}
}
}