1. Are you ready for the Galaxy S20? Here is everything we know so far!

Post values using Volley

Discussion in 'Android Development' started by RameshbabuK, Oct 27, 2014.

  1. RameshbabuK

    RameshbabuK Newbie
    Thread Starter

    Hi,

    I tried to post parameters to server. And I used JSONObjectRequest and

    StringRequest also using Volley. But parameter won't send to server.

    Please help for solve this issue.:eek:


    Kindly check given below code details.

    HashMap<String, String> params = new HashMap<String, String>();
    params.put("username", "demo@tracme.co.in");
    params.put("password", "demo");

    try {

    JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.POST,
    aURL,new JSONObject(params),
    new Response.Listener<JSONObject>() {

    @Override
    public void onResponse(JSONObject response) {
    Log.d("#######", response.toString());

    resultTxt.setText(response.toString());

    aDialog.hide();
    }
    }, new Response.ErrorListener() {

    @Override
    public void onErrorResponse(VolleyError error) {
    VolleyLog.d("********",
    "Error: " + error.getMessage());

    resultTxt.setText(error.toString());

    aDialog.hide();
    }
    }) {

    };
    // Adding request to request queue
    aQueue.add(jsonObjReq);


    Thanks&Regards,
    Ramesh babu.K
     



    1. Download the Forums for Android™ app!


      Download

       
  2. Unforgiven

    Unforgiven ...eschew obfuscation...
    Moderator

    Welcome to AndroidForums.com RameshbabuK.:)

    I moved your thread to our application development forum where you are more likely to get a useful answer.

    Good luck with your app.:thumb:
     
    RameshbabuK likes this.
Loading...

Share This Page

Loading...