Enzo Manuel Mangano
Enzo Manuel Mangano

Reputation: 686

Volley Library. Where I'm wrong with the Response Listener?

Where I'm wrong with this code? The Response it's always on ErrorListener.. But I'm not able to understand why. I'm passing the correct parameters of the API.

     val jsonobj = JSONObject()


        loginBtn.setOnClickListener {
            jsonobj.put("mail", mailTxt.text)
            jsonobj.put("pass", passTxt.text)
            val que = Volley.newRequestQueue(this@MainActivity)
            val req = JsonObjectRequest(Request.Method.POST, url, jsonobj,
                    Response.Listener{
                        toast("Yes")
                   }, Response.ErrorListener {
                toast("Error")
            })
            que.add(req)
        }
   }
}

Upvotes: 0

Views: 559

Answers (1)

Enzokie
Enzokie

Reputation: 7415

Just add the Internet permission

<manifest xlmns:android...>
    ...
    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

Upvotes: 1

Related Questions