0
I need to take getUid from the connected user and set the id in an editText. I left it down just to show what I want to do, because that way it doesn’t work. How can I call a getUid connected to any part of the code and set it as Edittext?
private EditText userId;
private FirebaseAuth.AuthStateListener minhaAuthListener;
userId = (EditText)findViewById(R.id.userId);
minhaAuthListener = new FirebaseAuth.AuthStateListener(){
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
Log.d("meuLog", "Usuário conectado: " + user.getUid());
userId.setText(user.getUid());
}
};