0

I'm creating an app with rss feed and when I want to download a thumbnail of a post, I have to use jsoup parser. Here is a code of how I'm doing that:

String link;

public String getLink() {
    return link;
}

public void setLink(String link) {
    String url = getImageURL(link);
    this.link = url;
}

public String getImageURL(String url) {
    Document doc = null;
    try {
        doc = Jsoup.connect(url).get();
    }
    catch (IOException e) {
        e.printStackTrace();
    }
    Element masthead = doc.select("div.post-image").select("img[src~=(?i)\\.(png|jpe?g)]").first();
    url = masthead.absUrl("src");
    return url;
}

And after doing "Jsoup.connect(url).get();" opening an app lasts so long and in logcat I can see this:

06-24 12:16:03.734 2838-2838/pl.dariusz.app I/Choreographer: Skipped 34 frames!  The application may be doing too much work on its main thread.

What can I do to get rid of this statement and to speed up an app?

bioreset
  • 21
  • 2
  • Did you read [this](http://stackoverflow.com/questions/14678593/the-application-may-be-doing-too-much-work-on-its-main-thread), [this](http://stackoverflow.com/questions/22049375/too-much-work-in-main-thread-app-freezes), or [this](http://stackoverflow.com/questions/11266535/meaning-of-choreographer-messages-in-logcat)? – TDG Jun 24 '16 at 18:38
  • Yes, I read every of that answers and I still can't see a solution for my problem (I know what to do, but don't know how I can prepare my code for that). – bioreset Jun 24 '16 at 22:28

0 Answers0