• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Post values using Volley

RameshbabuK

Newbie
Apr 16, 2014
23
2
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
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones