JsonObjectRequest jsonRequest = new JsonObjectRequest(Request.Method.POST,url , jsonobj,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject respStr) {
if (respStr != null) {
//// some code
}}};
new Response.ErrorListener() {``
@Override
public void onErrorResponse(VolleyError error) {
pDialog.dismiss();
Toast.makeText(CodeActivity.this, "Network Error", Toast.LENGTH_LONG).show();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("Authorization", "Bearer " + token);
return params;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(jsonRequest);`
}
I have this Error in my logcat. BasicNetwork.performRequest: Unexpected response code 405 for url I use Volley to send a request.