Created
November 14, 2016 18:56
-
-
Save marosc/20b1056084009347623ed70a99ab9f7c to your computer and use it in GitHub Desktop.
This file contains 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 sr = new StringRequest(Request.Method.POST,"http://api.someservice.com/post/comment", new Response.Listener<String>() { | |
@Override | |
public void onResponse(String response) { | |
mPostCommentResponse.requestCompleted(); | |
} | |
}, new Response.ErrorListener() { | |
@Override | |
public void onErrorResponse(VolleyError error) { | |
mPostCommentResponse.requestEndedWithError(error); | |
} | |
}){ | |
@Override | |
protected Map<String,String> getParams(){ | |
//post params | |
Map<String,String> params = new HashMap<String, String>(); | |
params.put("user",userAccount.getUsername()); | |
params.put("pass",userAccount.getPassword()); | |
params.put("comment", Uri.encode(comment)); | |
params.put("comment_post_ID",String.valueOf(postId)); | |
params.put("blogId",String.valueOf(blogId)); | |
return params; | |
} | |
@Override | |
public Map<String, String> getHeaders() throws AuthFailureError { | |
//headers params | |
Map<String,String> params = new HashMap<String, String>(); | |
params.put("Content-Type","application/x-www-form-urlencoded"); | |
return params; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment