Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. String url = "www.example.com"; // enter url here
  2.  
  3. JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null,
  4. new Response.Listener<JSONObject>() {
  5. @Override
  6. public void onResponse(JSONObject response) {
  7.  
  8. // Handle your response
  9.  
  10. }
  11.  
  12. }, new Response.ErrorListener() {
  13. @Override
  14. public void onErrorResponse(VolleyError error) {
  15.  
  16. // Handle your error
  17.  
  18. }
  19.  
  20. }){
  21. @Override
  22. public Map<String, String> getHeaders() throws AuthFailureError {
  23. Map<String, String> params = new HashMap<String, String>();
  24. params.put("Accept-Language", "en");
  25.  
  26. return params;
  27. }
  28. };
  29.  
  30.  
  31.  
  32. MainApplication.getInstance(this).addToRequestQueue(jsonObjectRequest);
  33. }[enter image description here][1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement