I want to parse an HTML page in order to get the first.jpg link, and setting its link to a WebView, in order to view the image on the app. I use AsyncTask. It seems to work, but I encounter an exception on the Try block. On the LogCat it's just shown ERROR PARSING ERROR (as you can see, that's how I chosen in the Catch group). But no explanation on what causes the exception. The code is as follows:
@Override
protected String doInBackground(String... params) {
TextView prova = (TextView)findViewById(R.id.searchedName);
Document doc;
try {
doc = Jsoup.connect("[url]http://www.lolking.net/summoner/euw/42997801")
.userAgent("Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22")
.timeout(3000).get();
String icon = doc.select("img[src$=.jpg]").first().text();
WebView summonerIcon = (WebView)findViewById(R.id.webView1);
summonerIcon.loadUrl(icon);
} catch (Exception e) {
Log.e("ERROR", "PARSING ERROR");
}
return null;
}
But no explanation on what causes the exceptionbecause you don't log any.