I need to define the client data in a TextView. I tried setting the email, but it did not work, because the return is null.
public class PerfilActivity extends AppCompatActivity {
private TextView tv_email;
private FirebaseAuth auth;
private Usuario usuario = new Usuario();
private DatabaseReference firebaseDatabase;
private ValueEventListener valueEventListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_perfil);
tv_email = findViewById(R.id.tv_email_perfil);
auth = FirebaseAuth.getInstance();
firebaseDatabase = ConfiguracaoFirebase.getFirebaseDatabase()
.child("usuarios/clientes"+ usuario.getUid()+ "/email");
valueEventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
tv_email.setText(String.valueOf(dataSnapshot.getValue()));
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
}
}