Android, takes one second to get String from Sharedpreferences -


i have following simple test try fetch data sharedpreferences:

  long begin =  system.currenttimemillis();   long end = 0;   log.d(tag, "getsharepreferences: " + begin+"");                    sharedpreferences settings = cordova.getactivity().getsharedpreferences(preferencelib, context.mode_private);     end = system.currenttimemillis(); log.d(tag, "getsharepreferences end 2: " + (end - begin));    string returnvalue = settings.getstring(preferencename, ""); // <- took 1 sec !!!!    end = system.currenttimemillis(); log.d(tag, "getsharepreferences end 3: " + (end - begin)); 

and results:

06-29 23:31:41.269: d/meetercalendar(21327): getsharepreferences end 2: 4 06-29 23:31:42.300: d/meetercalendar(21327): getsharepreferences end 3: 1031 

why fetch string sharepreferences takes 700-1000 milliseconds?

the string simple: "true"

sharedpreferences stored in xml files on internal storage. call getpreferences() trigger background thread load , parse xml file, work not complete time getstring() call occurs on next line. wind blocking waiting disk i/o , xml parsing complete.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -