when view is loaded, I add hard coded 2 values to mainlist array to show. and then I read 3values from file system of my phone
and add it to mainlist to show it more on view.
but it takes to much time to show values from file system…funny thing is that when I check log, it already load 3 value…
below is how I get 3 values and put it in mainlist array to show it main page view…
it show all value 10 seconds after it logs “done”
gotFile(fileEntry) {
console.log(fileEntry);
console.log("getfile comecc")
fileEntry.file((file)=> {
console.log("file is")
console.log(file);
var reader = new FileReader();
var a =reader.readAsText(file);
reader.onloadend = ((e: any) => {
var a=e.target;
var jsonvalue=JSON.parse(JSON.stringify( a._result));
var newvaluee=jsonvalue.split("&");
for(var i=0; i<newvaluee.length; i++){
this.mainlist.push(JSON.parse(newvaluee[i]));
}
console.log(this.mainlist);
// this.totallist=this.mainlist;
console.log("done")
window.alert(this.mainlist.length);
});
});
}