Question : java.lang.nullpointerexception: attempt to invoke virtual method 'java.lang.string com.google.firebase.auth.firebaseuser.getuid()' on a null object reference
Answered by : hannan
The following lines of code
String currentUserId;
mAuth = FirebaseAuth.getInstance();
currentUser = mAuth.getCurrentUser();
if(currentUser!= null) { currentUserId = currentUser.getUid(); //Do what you need to do with the id
}
Source : | Last Update : Mon, 13 Jun 22