I have a working example with Jsoup and AsyncTask, and that works fine. I am just not satisfied with the performance. It takes 3-6 seconds to load a simple list page with text and images.
I want to boost the performance somehow... so I have stumbled on volley.
Can anyone explain hot to use volley with jsoup?
I use this to get the doc object that holds the particular URL:
public Document GetDocument(String site) {
Document doc = Jsoup.connect(site).timeout(600000)
.data("query", "Java")
.userAgent("Mozilla")
.get();
return doc;
}
I guess I would only analyze the data with jsoup and connect/download with volley? Whene I use Jsoup.connect(site).timeout(600000) I should do that with volley ?
Can anyone write/link a simple example using volley and jsoup?
With Stephan`s answer I have made some little modifications to this code and it looks like this. I have added UTF 8 support so it can read other languages and specified the retry policy.
Under the hood, Jsoup make use of
HttpUrlConnection
. This class has known unresolved issues, bugs and performance issues on the Android Platform.Instead, load the data with Volley first then parse it with Jsoup.
Sample Code:
References