java - Android: Jsoup fails to parse in AsyncTask -


i've got asynctask setup following:

private class parsehtmloperation extends asynctask<string, void, list<shout>> {      @override     protected list<shout> doinbackground(string... params) {         list<shout> shouts = new linkedlist<>();          document doc = jsoup.parse(params[0]);         elements messages = doc.select("li");          (int = messages.size() - 1; >= 0; i--) {             element tempelement = messages.get(i);              string username = tempelement.select(".username").text();             string message = tempelement.select(".message").text();              shouts.add(new shout(r.drawable.ic_launcher, username, message);         }          return shouts;     }      @override     protected void onpostexecute(list<shout> result) {         adapter.clear();         adapter.data = result.toarray(new shout[result.size()]);         adapter.addall(result);         adapter.notifydatasetchanged();         setprogressbarindeterminatevisibility(false);     }      @override     protected void onpreexecute() {         setprogressbarindeterminatevisibility(true);     } } 

the problem here is: if there going on in ui, (i've tested far progressbar, modal popup , progressbarindeterminate) line

document doc = jsoup.parse(params[0]); 

fails complete. spits in console:

i/art﹕ background sticky concurrent mark sweep gc freed 1673(100kb) allocspace objects, 0(0b) los objects, 965% free, 2mb/4mb, paused 8.964ms total 96.186ms

i/art﹕ background partial concurrent mark sweep gc freed 2716(200kb) allocspace objects, 9(754kb) los objects, 1081% free, 2mb/4mb, paused 14.142ms total 210.242ms

i/art﹕ background partial concurrent mark sweep gc freed 2219(112kb) allocspace objects, 3(88kb) los objects, 733% free, 2mb/6mb, paused 14.403ms total 167.266ms

i/art﹕ background sticky concurrent mark sweep gc freed 2194(131kb) allocspace objects, 0(0b) los objects, 700% free, 3mb/6mb, paused 9.194ms total 149.442ms

but, if press home button; happily finishes parsing within few seconds.

if comment out both of setprogressbar... methods parses without problem.

edit: finish parsing eventually... takes closer 100000ms, when done within max 5000ms, in addition takes 7000ms jump onpostexecute(); block, when goes there way under 100ms.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -