I need help to make a comparison with the value returned from the function in PHP, in the application it shows this error: java.lang.NullPointerException
Code on Android
contactSelect = new JsonClassSelect().execute(new String[]{"http://meuIP:8080/meucaminho/login/" + email+"/"+senha});
email = "";
try {
krueger = contactSelect.get().toString();
if ("0".equals(krueger))
{
Toast.makeText(getApplicationContext(), "Usuário e/ ou senha inválidos!", Toast.LENGTH_LONG).show();
}
else
{
txtResult.setText(krueger);
}
//Toast.makeText(getApplicationContext(), contact.get().toString(), Toast.LENGTH_LONG).show();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
PHP Code
function loginUsuario($nm_email_usuario, $cd_senha_usuario){
$stmt=getConn()->query("SELECT * FROM tb_usuario where nm_email_usuario='$nm_email_usuario' and cd_senha_usuario='".md5($cd_senha_usuario)."'");
$usuario=$stmt->fetchAll(PDO::FETCH_OBJ);
if (!empty($usuario))
{
echo "{\"Usuario\":".json_encode($usuario)."}";
}
else
{
$usuario= "0";
echo json_encode($usuario);'
}
}