Load only div from a specific site

Asked

Viewed 76 times

1

Hello I am trying to take all the information from a page to a webview via jsoup but the letters are all deformed when I load and it doesn’t look like this on the site , there is some way to load the site , but only the div I want, in this case is the div "inside2" ?

This is the site : http://www.dges.gov.pt/guias/detcursopi.asp?codc=8184&code=0400

Code in which it loads the information but is deformed :

private class MyTask extends AsyncTask<String, Integer, String> {

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    protected String doInBackground(String... params) {

        Bundle CursoInfoData = getIntent().getExtras();

        site = CursoInfoData.getString("site");

        Document doc = null;
        try {
            doc = Jsoup.connect(site).get();
        } catch (IOException e) {
            e.printStackTrace();
        }
         ele = doc.select(".inside2");
        return "start";
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        super.onProgressUpdate(values);
    }

    @Override
    protected void onPostExecute(String result) {
        super.onPostExecute(result);
        String text = "<html><head>"
                + "<style type=\"text/css\">body{color: #01A9DB; background-color: #FFFFFF;}"
                + "</style></head>"
                + "<body>"
                + ele.toString()
                + "</body></html>";
        cursoInfoWeb.loadData(text, "text/html", "utf-8");
    }
}

Fica deformado como mostro nesta imagem

  • the page uses iso-8859-1 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.