Java.lang.nullpointerexception: Attempt To Invoke Virtual Method 'java.lang.string Com.google.firebase.auth.firebaseuser.getuid()' On A

[Solved] Java.lang.nullpointerexception: Attempt To Invoke Virtual Method 'java.lang.string Com.google.firebase.auth.firebaseuser.getuid()' On A | Kotlin - Code Explorer | yomemimo.com
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

Answers related to java.lang.nullpointerexception: attempt to invoke virtual method 'java.lang.string com.google.firebase.auth.firebaseuser.getuid()' on a null object reference

Code Explorer Popular Question For Kotlin