Skip to content Skip to sidebar Skip to footer

Android Parse Html Table

I need to parse data table look like this:
&l

Solution 1:

You ca use Jsoup HTML parser to get the required data

Step 1. Download the jsoup.jar from http://jsoup.org/download

Step 2. Add it to the libs folder of your project.

Step 3. Extract Data required

    ArrayList<String> list = new ArrayList<String>();
    Document doc = Jsoup.parse("your html");  
    Elements elements = doc.select("strong");
    for(int i=0;i<elements.size();i++)
    {

        list.add(elements.get(i).text().toString());

    }

Finally

ArrayAdapter<String> adapter = newArrayAdapter<String>(ActivityName.this,android.R.layout.simple_list_item_1,list);
listview.setAdapter(adapter);

Solution 2:

As CommonsWare sayed in this post

There are many HTML parsers : http://java-source.net/open-source/html-parsers

Post a Comment for "Android Parse Html Table"