I need to display a part of a page in Android Studio's Webview, the section containing the PDFs. This is the website I need https://www.limerick.ie/council/weekly-planning-lists and the part I want to show is this https://i.stack.imgur.com/6HfsL.png When I try to run my code, the Webview doesn't display anything and comes up blank.
Here is my code
package com.example.john_000.jsouptest;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
public class MainActivity extends Activity {
public class HtmlParserActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView cardapio = (WebView) findViewById(R.id.webView);
cardapio.getSettings().setJavaScriptEnabled(true);
String data = "";
Document doc = null;
try {
doc = Jsoup.connect("https://www.limerick.ie/council/weekly-planning-lists").get();
Elements elements = doc.getElementsByClass("block-inner clearfix");
for (Element element : elements) {
data += element.outerHtml();
data += "<br/>";
}
cardapio.loadData(data, "text/html", "UTF-8");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
If anybody knows how to parse this HTML so that I only show the required table your help would be greatly appreciated.