i´m trying to get data from my firebase database when a user log in successfully, but i can´t do it with the code that I have, let me paste you my code:
login class:
AdminFirebase.loadAdmin(task.getResult().getUser());
AdminFirebase class:
private static DatabaseReference adminRef= ref.child("Administradores");
public static void loadAdmin(FirebaseUser user){
DatabaseReference userRef=adminRef.child(user.getUid());
userRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Administrador administrador=dataSnapshot.getValue(Administrador.class);
Sesion.admin=administrador;
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
I already debug my code and when the code its on the userRef.addListener as you can see on the image, all the data its according with the database, but when I try to execute the next code it skip until the finish of the method,so it seems that something its wrong on that line, could somebody help me with this?