I'm trying to make a condition on firebase, taking value, but I'm not sure how to do it.
I need to do this, if the value is horizontal do this, if you do not do that.
My firebase:
leitura: "horizontal"
String emailUsuario = autenticacao.getCurrentUser().getEmail();
String idUsuario = CustomBase64.codificarBase64( emailUsuario );
favoritosRef = firebaseRef.child("usuarios").child(idUsuario);
valueEventListenerLeitor = favoritosRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.child("leitura").getValue() == "horizontal") {
Log.e("TAG", "=======" + dataSnapshot.child("leitura").getValue());
} else {
Log.e("TAG", "=======" + "Vertical");
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});