I'm trying to access this website : https://casino.betin.co.ke/virtual/Virtual+Football using Jsoup to get text from it's elements but I get errors. Here is my code snippet:
public static final String URL = "https://casino.betin.co.ke/virtual/Virtual+Football";
public void getTitle() {
StringRequest titleRequest = new StringRequest(Request.Method.GET, URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Document document = Jsoup.parse(response);
Element element = document.select("div.matchlist-header").first();
Toast.makeText(mContent, element.text(), Toast.LENGTH_SHORT).show();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
});
This is the error I get in android studio
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.jsoup.nodes.Element.text()' on a null object reference