1

I'm trying to get HTML Page from list of link in my android app to generate Link Preview then need to display these preview in RecycleView. I used this Code to get HTML Page

Jsoup.connect(url).userAgent("Mozilla").get();

but these code is running jsut in AsyncTask.

when make for loop for each link in List we create new AsyncTask for each link request. that take too long time to finish it?

what the best way to do this with out take long time.

Stephan
  • 41,764
  • 65
  • 238
  • 329
  • Possible duplicate of [How to use Jsoup with Volley?](http://stackoverflow.com/questions/35674580/how-to-use-jsoup-with-volley) – Stephan Mar 21 '16 at 09:58

2 Answers2

0

You could try using WebView instead, see here http://developer.android.com/reference/android/webkit/WebView.html

MackAttack
  • 73
  • 7
0

Jsoup uses HttpUrlConnection for fetching the link. On Android this class is notoriously slow. This is why you're experimenting those long response times.

Instead use the Volley library, specially designed to adress this issue.

You can find a full example here: How to use Jsoup with Volley?

Community
  • 1
  • 1
Stephan
  • 41,764
  • 65
  • 238
  • 329