I am trying to parse HTML using jsoup Parser for Android.
If I run my code, I'm unable to get into the for loop; program execution is stopping before the for loop (No error is output).
I had put Log? The same code when I run in normal java project I'm able to get the result?
private class DownloadTwitterTask extends
AsyncTask<String, Void, List<String>> {
String content;
protected List<String> doInBackground(String... urls) {
try {
doc = Jsoup.connect("https://twitter.com/someperson/").get();
} catch (IOException e) {
// TODO Auto-generated catch block
Log.d("Exception", "Exception");
e.printStackTrace();
}
Elements elements = doc.getElementsByAttributeValue("class",
"js-tweet-text tweet-text");
for (int j=0;j<elements.size();j++) {
Element tmp = elements.get(j);
String value = tmp.text();
twitterList.add(value);
}
return twitterList;
}
protected void onPostExecute(List<String> result) {
tadaptor = new TwitterLazyAdaptor(INFOActivity.this, result);
// this.setListAdapter(fadaptor);
lv1.setAdapter(tadaptor);
}
}
elementsis just empty?for:)