Jsoup显示数据的TextView [英] Jsoup display data to textview

查看:288
本文介绍了Jsoup显示数据的TextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我解析的HTML网页与jsoup。现在我想在我的TextView显示我的分析数据。

I parsed a html web page with jsoup. now i want to display my parsed data in my textview.

code

    String ID = loginpreferences.getString("ID", null);
    String Type = loginpreferences.getString("Type", null);

    String myURL = "http://roosters.gepro-osi.nl/roosters/rooster.php?leerling="+ID+"&type=Leerlingrooster&afdeling="+Type+"&tabblad=2&school=905";



        Document doc = null;
        try {
            doc = Jsoup.connect(myURL).get();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        Elements data = doc.select(".1nameheader");




}    
}

我试图

Textview1.SetText(data);

但是,这并不能正常工作。

But that didn't work.

推荐答案

好像要从元素的列表打印文本值。要做到这一点,你需要遍历元素的列表,并获取文本了出来。

Seems as if you want to print the text values from a list of Elements. To do so you need to iterate over the list of Elements and get the text out of them.

   StringBuilder text = new StringBuilder();
   for(Element e: data){
       text.append(e.text());
   }
   Textview1.setText(text.toString());

这篇关于Jsoup显示数据的TextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆