I am trying to cite some of the contents of a website. I decided to use Jsoup because with it I can take part of the site that you want and play the html part of this output in a web review. It seemed easy to me, but I tried to run my application and did not work. Below is my code. What is wrong with him?
Note. If there is another easier way to do this, give me a hint! But I want to get the content in real time, okay? Thanks everyone!
public class RestauranteUniversitarioActivity extends the action {
@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"); }
}
source share