I'm having the following problem, I'm making an app that contains login and user registration and I'm using code in PHP and JSON for this. But I checked my Response.Listener is never called, the execution jumps it ... The code that is on the Main:
Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
Toast.makeText(Register.this, "entrou", Toast.LENGTH_SHORT).show();
JSONObject jsonObject = new JSONObject(response);
boolean success = jsonObject.getBoolean("success");
if(success)
{
Toast.makeText(Register.this, "Entrou", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(Register.this, "Erro", Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
};
And this is my RegisterRequest:
public class RegisterRequest extends StringRequest {
private static final String REGISTER_REQUEST_URL = "kameo.com.br/control/ayzac_control_signin_mobile.php";
private Map<String, String> params;
public RegisterRequest(String email, String name, String nickname, String password, String date, String gender, Response.Listener<String> listener)
{
super(Method.POST, REGISTER_REQUEST_URL, listener, null);
params = new HashMap<>();
params.put("userEmail", email);
params.put("userName", name);
params.put("userNickname", nickname);
params.put("userPassword", password);
params.put("userBirth", date);
params.put("userGender", gender);
}
@Override
public Map<String, String> getParams() {
return params;
}
}