I'm trying to bring a part of the contents of a website. I decided to use the Jsoup because with it I can take the part of the site you want and play the html part of this withdrawal within a webview. It seemed easy, but I tried to run my application and did not work. Below is my code. What's wrong with him?
Note: If there is another simpler way to do this, pass me the hint! But I want to get the contents in real time, ok? Thanks to all!
public class RestauranteUniversitarioActivity extends Activity {
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView cardapio = (WebView)findViewById(R.id.web_engine); cardapio.getSettings().setJavaScriptEnabled(true); String data = ""; Document doc = null; try { doc = Jsoup.connect("http://www.iguatu.ce.gov.br/").get(); } catch (IOException e) { e.printStackTrace(); } Elements content = doc.getElementsByClass("dest-left"); if(content.size() > 0) { data = content.get(1).text(); } cardapio.loadData(data, "text/html", "UTF-8"); }
}