0

I have this Volley Request:

val queue = newRequestQueue(this)
val url = "https://www.meme-api.com/gimme"
val JsonObjectRequest = JsonObjectRequest(
    com.android.volley.Request.Method.GET,url,null,
    Response.Listener{response ->
        val url = response.getString(url)
        Glide.with(this).load(url).into(binding.meme)
    },
    Response.ErrorListener{
        Toast.makeText(this,"Something Went Wrong",Toast.LENGTH_LONG).show()
    })
queue.add(JsonObjectRequest)

And I have the internet permission in android manifest.

It is never going into response.listener

Micke
  • 2,251
  • 5
  • 33
  • 48
  • You should display some meaningful error messages in your ```Response.ErrorListener``` instead of just a general toast message. Refer [here](https://stackoverflow.com/questions/26167631/how-to-access-the-contents-of-an-error-response-in-volley) to access contents of ```VolleyError```. And I have tried a GET method using Postman and don't think your URL is accessible: ```Error: getaddrinfo ENOTFOUND www.meme-api.com```. – Enowneb Mar 03 '23 at 06:00

0 Answers0