I have a string that currently only receives "ERROR" and I made an if for when it gave me this value I executed some things, it happens that the comparison always fails, even if the strings being exactly the same, I always compared string that way, no I understand why it is not working:
try {
String mensagem = response.body().getAsJsonObject().get("error").getAsJsonObject().get("msg").toString();
String status = response.body().getAsJsonObject().get("status").toString();
//Log.i(TAG, "onResponse: "+mensagem);
Log.i(TAG, "onResponse: "+status);
if(status.equals("ERROR")){
Toast.makeText(SplashScreen.this, mensagem, Toast.LENGTH_SHORT).show();
habilitarformgerarsenha(true);
}else{
Log.i(TAG, "onResponse: Status mensagem:" + status);
}
}catch (NullPointerException e){
Log.i(TAG, "onResponse: "+e);
}
LOG:
02-05 23:57:41.036 30711-30711/1.com.br.doup I/igr: onResponse: "ERROR"
02-05 23:57:41.036 30711-30711/1.com.br.doup I/igr: onResponse: Status mensagem:"ERROR"