Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Parse and display a table in Jsoup android
    text
    copied!<p>i have some problems with jsoup.</p> <p>this is the link i want to parse: <a href="http://roosters.gepro-osi.nl/roosters/rooster.php?klassen%5B%5D=L2vp&amp;type=Klasrooster&amp;wijzigingen=1&amp;school=905/" rel="nofollow">http://roosters.gepro-osi.nl/roosters/rooster.php?klassen%5B%5D=L2vp&amp;type=Klasrooster&amp;wijzigingen=1&amp;school=905/</a> . I want to select te table content and display it nice and clean in my app. this is the script i already have:</p> <pre><code> package rsg.deborgen.nl; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class Lindenborg1Activity extends Activity { Button btn_2p; // blog url static final String BLOG_URL = "http://roosters.gepro-osi.nl/roosters/rooster.php?klassen%5B%5D=L2vp&amp;type=Klasrooster&amp;wijzigingen=1&amp;school=905/"; @Override public void onCreate(Bundle savedInstanceState) { // set layout view super.onCreate(savedInstanceState); setContentView(R.layout.main); btn_2p =(Button) findViewById(R.id.button1); btn_2p.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub // process // set layout view setContentView(R.layout.rooster); try { ((TextView)findViewById(R.id.tv)).setText(getBlogStats()); } catch (Exception ex) { ((TextView)findViewById(R.id.tv)).setText("Error"); } } protected String getBlogStats() throws Exception { String result = ""; // get html document structure Document document = Jsoup.connect(BLOG_URL).get(); // selector query Elements nodeBlogStats = document.select("td.tableheader"); // check results if(nodeBlogStats.size() &gt; 0) { // get value result = nodeBlogStats.get(0).text(); } // return return result; </code></pre> <p>(i leaved away the end because of it was going wrong with code block)</p> <p>but if i run it now it shows me the whole site and i want only the text in the table. so please help me, thanks!</p> <p>(Ps. this script is from another tut but i can't remeber its name and sorry for my nooblism and bad english :D )</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload