1
In case I want to know how to get only the GET value of the link ".../posses_cadastro" to enter If or Else.
public class LoginRequest extends StringRequest {
private static final String REGISTER_REQUEST_URL = "http://192.168.30.12:5000/possui_cadastro";
private Map<String, String> params;
public LoginRequest(Response.Listener<String> listener) {
super(Method.GET, REGISTER_REQUEST_URL, new Response.Listener<String>()
{
@Override
public void onResponse(String response) {
// display response
if (response.toString() == "1") {
Context mContext = null;
Intent intent = new Intent(mContext, GpsActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
}
else {
Context mContext = null;
Intent intent = new Intent(mContext, RegisterActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("Error.Response", String.valueOf(error));
}
});