Skip to content Skip to sidebar Skip to footer

Jsoup Display Data To 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 = loginprefer

Solution 1:

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());

Solution 2:

Line

Textview1.SetText(data);

shouldn't even compile.

From Android TextView class reference:

finalvoidsetText(CharSequence text)
             Sets the string value of the TextView.

You're giving Elements class instance to the method.

Element and Elements classes of JSoup provide you with html() and text() methods that you should use in that case.

Solution 3:

Have you tried android.text.html.forHtml(String)? This method gets a html as input and returns a spanned text that you cat set it to a TextView

Post a Comment for "Jsoup Display Data To Textview"