Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Volley api to post parameters

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 177
    Comment on it

    Volley api is powerful api to perform network operation like to perform long running network operations.

    you have to create HashMap that will contain key value pair for each variable and then put that hashmap object in JsonObjectRequest as a parameter.

     HashMap<String, String> params = new HashMap<String, String>();
    
     params.put("key3", "value");   
     params.put("key4", "value");
    
        JsonObjectRequest req = new JsonObjectRequest(URL, new JSONObject(params),
    
           new Response.Listener<JSONObject>() {
               @Override
               public void onResponse(JSONObject response) {
    
                   Log.e("Response:%n %s", response.toString());
    
               }
           }, new Response.ErrorListener() {
               @Override
               public void onErrorResponse(VolleyError error) {
    
                  Log.e("Error: ", error.getMessage());
    
               }
           });
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: