Created
April 27, 2016 16:18
-
-
Save ishmaelmakitla/bb48f64aa193cb8be38dd3b94ecaa0a3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StringRequest putRequest = new StringRequest(Request.Method.PUT, url, | |
new Response.Listener<String>() | |
{ | |
@Override | |
public void onResponse(String response) { | |
delegate.postNotificationSucced(); | |
} | |
}, | |
new Response.ErrorListener() | |
{ | |
@Override | |
public void onErrorResponse(VolleyError error) { | |
VolleyLog.d(TAG, "Error: " + error.getMessage()); | |
Log.d(TAG, ""+error.getMessage()+","+error.toString()); | |
delegate.postNotificationFailed((APIErrors) error); | |
} | |
} | |
) { | |
@Override | |
protected Map<String, String> getParams() | |
{ | |
Map<String, String> params = new HashMap<String, String> (); | |
params.put("Content-Type","application/x-www-form-urlencoded"); | |
params.put("state", Boolean.toString(isChecked)); | |
return params; | |
} | |
@Override | |
protected VolleyError parseNetworkError(VolleyError volleyError){ | |
APIErrors error = null; | |
if(volleyError.networkResponse != null && volleyError.networkResponse.data != null){ | |
error = new APIErrors(new String(volleyError.networkResponse.data)); | |
} | |
return error; | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment