Good, what I'm trying to do is send a json from Android with Volley to a php that I have on my server, within the php I make some queries and I need to return another json (response) to work with that data. I clarify that PHP works well with another APP that uses httpPost, but since it is deprecated I am updating the APP using VOLLEY
The problem that I have is that it does not enter the code, with the debug I realize that of the first line
JsonObjectRequest postRequest = new JsonObjectRequest( Request.Method.POST, URL,
jsonParams,
new Response.Listener<JSONObject>() {
Jump directly to the next line out of this function maybe I have something wrong with the parameters or the declaration, I leave the code
**** Desde esta primera linea salta directamente a requestQueue.add(postRequest); sin entrar *****
JsonObjectRequest postRequest = new JsonObjectRequest( Request.Method.POST, URL,
jsonParams,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONObject Obj = response;
JSONArray jarray = Obj.getJSONArray("usu");
if (jarray.length() <= 0) {
Toast.makeText(getApplicationContext(), "SIN REGISTROS PARA ACTUALIZAR", Toast.LENGTH_SHORT).show();
} else {
for (int i = 0; i < jarray.length(); i++) {
JSONObject object1 = jarray.getJSONObject(i);
String variable = object1.getString("variable");
String variable2 = object1.getString("variable2");
}
}
} catch (JSONException e) {
e.printStackTrace();
}
dialog.dismiss();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
dialog.dismiss();
}
}) {
};
*** salta directamente a esta línea ****
requestQueue = Volley.newRequestQueue(SettingsActivity.this);
requestQueue.add(postRequest);
**** En la línea anterior me muestra lo siguiente debugeando: RequestQueue: RequestQueue@5107 postRequest: "[] www.url.com/php/ejemplo.php 0xb7f7dc44 NORMAL null"
}else{
Toast toast1 = Toast.makeText(getApplicationContext(),"El Servicior y/o el Usuario no pueden estar vacíos", Toast.LENGTH_SHORT);
toast1.show();
}
}
});
}
THANK YOU !!!