This question already has an answer here:
- How do I compare strings in Java? 23 answers
I am trying to hide a button if a logged in user is a Donor. I have my code like this.
String typ = user.get("type").toString();
Log.d("before checking type", typ);
if (typ == "Donor"){
ne.setVisibility(View.GONE);
//ne.setEnabled(false);
}
In the log, I get the result Donor, so I know the call to the database is working. But the button I need to hide, doesn't hide. Anyone knows why?
Aucun commentaire:
Enregistrer un commentaire