我正在创建一个从 www.zamboangatoday.ph 收集数据的 android 应用程序,获取所有新闻标题或标题。但我只能检索一项可以有人检查我的代码。
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();
}
}