I need help parsing an html file from my schools website, I know this code is bad BUT there is hardly any decent tutorial on html parsing for android so I ATTEMPTED this. I am still in the beginning of my software stages so bare with me! Thanks! ^-^
package com.example.test;
import java.io.IOException;
import android.os.Bundle;
import org.jsoup.Jsoup;
import org.jsoup.helper.Validate;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;
public class Parsing extends Activity {
Document doc;
Element Link;
String linkhref;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
Document doc = Jsoup.connect("www.csn.edu/events.asp").get();
} catch (IOException e) {
System.out.print("failed");
e.printStackTrace();
}
Element link= doc.select("table.cal-StudentActivitiesandEvents-row").first();
linkhref=link.attr("href");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}