0
我正在創建一個從www.zamboangatoday.ph收集數據的android應用程序,獲取所有新聞標題或標題。但我可以檢索只有一個項目可以有人檢查我的代碼。使用jsoup解析來自網站的數據
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try{
outputTextView = (TextView)findViewById(R.id.textView1);
//Document doc = Jsoup.parse(html,"http://www.zamboangatoday.ph");
Document doc = Jsoup.connect("http://www.zamboangatoday.ph/").get();
//Elements tag = doc.select(".even h4 a");
Iterator<Element> iter = doc.select("li.even h4 a").iterator();
//List<Image> images = new ArrayList<Image>();
while(iter.hasNext())
{
Element element = iter.next();
outputTextView.setText(element.text());
}
}catch(Exception e)
{
e.printStackTrace();
}
}
感謝兄弟。它工作 – user1643284
好吧,我完成了。有人可以幫助我如何使用列表視圖來實現它。 – user1643284
如果這解決了你的問題,你可以[接受](http://stackoverflow.com/faq#howtoask)這個答案。 – ollo