cordova - Read text file on Android with Phonegap -
i trying read text file on android phonegap. have looked @ of examples , don't see difference in code. file has lines of text. onloadend results in length of 0. there no errors. missing here?
    function readtextfile(filename) {                                window.requestfilesystem(localfilesystem.temporary, 5*1024*1024,        successcallback, errorcallback);                                function successcallback(fs) {                                    fs.root.getfile(filename, {}, function(fileentry) {                                        fileentry.file(function(file) {                                            var reader = new filereader();                                            reader.onloadend = function(e) {                                                console.log("text file length: " + this.result.length);                                            };                                            reader.readastext(file);                                        }, errorcallback);                                    }, errorcallback);                                }                                 function errorcallback(error) {                                    console.log("error: " + error.code);                                }    }       
 
  
Comments
Post a Comment