Los parámetros de envío POST de Android Volley siempre son nulos
Soy nuevo en Android. Ahora estoy haciendo una aplicación. Para esta necesito enviar datos al servidor. Ahora estoy usando el método de publicación Volley. Pero los parámetros siempre se muestran nulos cuando envío datos al servidor usando volley. Aquí estoy adjunto el código por favor verifíquelo. Aquí estoy usando fragmentos.
Sección de código
String url = "http://192.168.1.182:8084/name/registration.jsp";
final ProgressDialog pDialog = new ProgressDialog(this.getActivity());
pDialog.setMessage("Loading...");
pDialog.show();
RequestQueue rq = Volley.newRequestQueue(getActivity().getApplicationContext());
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Method.POST,
url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d(TAG, response.toString());
// pDialog.hide();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
//pDialog.hide();
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("name", "Ajay K K");
params.put("mailid", "[email protected]");
params.put("phone", "8086327023");
params.put("place", "Calicut");
params.put("longitude","44444.3333");
params.put("latitude","666666.3333");
params.put("wheel", "1");
params.put("type", "owner");
return params;
}
};
// Adding request to request queue
rq.add(jsonObjReq);