title: Why I get NULL Result Fom Firebase
body: <p>I created a new user registration screen and after the user, registration goes to the login screen</p>
  
  <p>When registering a user, I want the application to verify the presence of the user in the database if the user exists. The application before moving the user to the home page can print some values ​​for this user such as email, account type, user name, and account status. Is it true or false?</p>
  
  <p>BUT WHEN I DO THAT I GET (NULL) ON ANDROID STUDIO CONSOLE</p>
  
  <p>MY LoginScreen</p>
  
  <pre><code>public class LoginScreen extends AppCompatActivity {
      private FirebaseAuth mAuth;
  
      FirebaseDatabase database = FirebaseDatabase.getInstance();
      final DatabaseReference myRef = database.getReference("users");
      final FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login_screen);
          final ProgressBar simpleProgressBar = (ProgressBar) findViewById(R.id.loginProgressBar);
          simpleProgressBar.setVisibility(View.INVISIBLE);
  
           mAuth = FirebaseAuth.getInstance();
  
      /*    mauthlistener = new FirebaseAuth.AuthStateListener() {
              @Override
              public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                  if (firebaseAuth.getCurrentUser() != null){
  
  
                  }
              }
          }*/
          final String TAG = "MyActivity";
  
          final Button gotosignupbtn = findViewById(R.id.gosignup);
          gotosignupbtn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent gotosignup = new Intent(LoginScreen.this, SignupScreen.class);
                  startActivity(gotosignup);
                  finish();
              }
          });
  
  
          final EditText email = findViewById(R.id.emaillogin);
          final EditText password = findViewById(R.id.passwordlogin);
  
          Button loginbt = findViewById(R.id.loginbtn);
  
          loginbt.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  simpleProgressBar.setVisibility(View.VISIBLE);
                  final String Email = email.getText().toString();
                  final String Password = password.getText().toString();
  
                  mAuth.signInWithEmailAndPassword(Email , Password).addOnCompleteListener(new OnCompleteListener&lt;AuthResult&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                        //  FirebaseUser  userr = FirebaseAuth.getInstance().getCurrentUser();
                          FirebaseUser user = firebaseAuth.getCurrentUser();
                          final String  userKey = user.getUid();
                         if (task.isSuccessful()){
                             simpleProgressBar.setVisibility(View.INVISIBLE);
  
                             myRef.child("users").child(userKey).addValueEventListener(new ValueEventListener() {
                                 @Override
                                 public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
  
                                     String userKey = dataSnapshot.child("\n" + "Email").getValue(String.class);
                                     Log.d(TAG, "Name: " + userKey);
  
  
  /*
                                     userdtails activestatus = dataSnapshot.getValue(userdtails.class);
                                     System.out.println(activestatus);*/
  
                                 }
  
                                 @Override
                                 public void onCancelled(@NonNull DatabaseError databaseError) {
  
                                 }
                             });
                             Toast.makeText(LoginScreen.this, "Authentication ok.",
                                     Toast.LENGTH_SHORT).show();
                             FirebaseAuth.getInstance().signOut();
  
  
                         }else{
                             simpleProgressBar.setVisibility(View.INVISIBLE);
                             Toast.makeText(LoginScreen.this, "Error.",
                                     Toast.LENGTH_SHORT).show();
  
                         }
                      }
                  });
              }
          });
  
  
      }
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/iyQOx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iyQOx.png" alt="This is screen od firebase child have make "></a></p>
  
  <p>logcat result</p>
  
  <pre><code>2020-04-23 01:23:56.974 16391-16391/? I/m.example.wafe: Not late-enabling -Xcheck:jni (already on)
  2020-04-23 01:23:57.063 16391-16391/? W/m.example.wafe: Unexpected CPU variant for X86 using defaults: x86
  2020-04-23 01:23:58.910 16391-16436/com.example.wafer W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
  2020-04-23 01:23:59.055 16391-16391/com.example.wafer I/FirebaseInitProvider: FirebaseApp initialization successful
  2020-04-23 01:23:59.057 16391-16443/com.example.wafer I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:12 and remote module com.google.android.gms.measurement.dynamite:0
  2020-04-23 01:23:59.058 16391-16443/com.example.wafer I/DynamiteModule: Selected local version of com.google.android.gms.measurement.dynamite
  2020-04-23 01:23:59.101 16391-16438/com.example.wafer W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
  2020-04-23 01:23:59.113 16391-16391/com.example.wafer W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@bd36e17
  2020-04-23 01:23:59.118 16391-16443/com.example.wafer W/m.example.wafe: Unsupported class loader
  2020-04-23 01:23:59.179 16391-16443/com.example.wafer W/m.example.wafe: Skipping duplicate class check due to unsupported classloader
  2020-04-23 01:23:59.230 16391-16438/com.example.wafer I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
  2020-04-23 01:23:59.282 16391-16391/com.example.wafer W/m.example.wafe: Accessing hidden method Landroid/graphics/drawable/Drawable;-&gt;getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking)
  2020-04-23 01:23:59.282 16391-16391/com.example.wafer W/m.example.wafe: Accessing hidden field Landroid/graphics/Insets;-&gt;left:I (light greylist, linking)
  2020-04-23 01:23:59.282 16391-16391/com.example.wafer W/m.example.wafe: Accessing hidden field Landroid/graphics/Insets;-&gt;right:I (light greylist, linking)
  2020-04-23 01:23:59.282 16391-16391/com.example.wafer W/m.example.wafe: Accessing hidden field Landroid/graphics/Insets;-&gt;top:I (light greylist, linking)
  2020-04-23 01:23:59.283 16391-16391/com.example.wafer W/m.example.wafe: Accessing hidden field Landroid/graphics/Insets;-&gt;bottom:I (light greylist, linking)
  2020-04-23 01:23:59.371 16391-16443/com.example.wafer V/FA: onActivityCreated
  2020-04-23 01:23:59.456 16391-16391/com.example.wafer W/m.example.wafe: Accessing hidden method Landroid/view/View;-&gt;computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
  2020-04-23 01:23:59.457 16391-16391/com.example.wafer W/m.example.wafe: Accessing hidden method Landroid/view/ViewGroup;-&gt;makeOptionalFitsSystemWindows()V (light greylist, reflection)
  2020-04-23 01:23:59.505 16391-16406/com.example.wafer I/m.example.wafe: Background concurrent copying GC freed 8715(2MB) AllocSpace objects, 10(264KB) LOS objects, 49% free, 1885KB/3MB, paused 980us total 242.804ms
  2020-04-23 01:23:59.642 16391-16447/com.example.wafer V/FA: App measurement collection enabled
  2020-04-23 01:23:59.647 16391-16447/com.example.wafer V/FA: App measurement enabled for app package, google app id: com.example.wafer, 1:1010017815503:android:4af4d088a0980531d0e0ba
  2020-04-23 01:23:59.655 16391-16447/com.example.wafer I/FA: App measurement initialized, version: 25001
  2020-04-23 01:23:59.655 16391-16447/com.example.wafer I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
  2020-04-23 01:23:59.655 16391-16447/com.example.wafer I/FA: To enable faster debug mode event logging run:
        adb shell setprop debug.firebase.analytics.app com.example.wafer
  2020-04-23 01:23:59.655 16391-16447/com.example.wafer D/FA: Debug-level message logging enabled
  2020-04-23 01:23:59.768 16391-16447/com.example.wafer V/FA: Connecting to remote service
  2020-04-23 01:23:59.807 16391-16447/com.example.wafer V/FA: Connection attempt already in progress
  2020-04-23 01:24:00.600 16391-16391/com.example.wafer D/OpenGLRenderer: HWUI GL Pipeline
  2020-04-23 01:24:00.602 16391-16447/com.example.wafer V/FA: Activity resumed, time: 59697897
  2020-04-23 01:24:00.633 16391-16447/com.example.wafer I/FA: Tag Manager is not found and thus will not be used
  2020-04-23 01:24:00.706 16391-16448/com.example.wafer D/HostConnection: HostConnection::get() New Host Connection established 0xe46982b0, tid 16448
  2020-04-23 01:24:00.707 16391-16448/com.example.wafer D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2 
  2020-04-23 01:24:00.728 16391-16448/com.example.wafer I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
  2020-04-23 01:24:00.728 16391-16448/com.example.wafer I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
  2020-04-23 01:24:00.729 16391-16448/com.example.wafer I/OpenGLRenderer: Initialized EGL, version 1.4
  2020-04-23 01:24:00.729 16391-16448/com.example.wafer D/OpenGLRenderer: Swap behavior 1
  2020-04-23 01:24:00.729 16391-16448/com.example.wafer W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
  2020-04-23 01:24:00.729 16391-16448/com.example.wafer D/OpenGLRenderer: Swap behavior 0
  2020-04-23 01:24:00.754 16391-16448/com.example.wafer D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
  2020-04-23 01:24:00.754 16391-16448/com.example.wafer D/EGL_emulation: eglCreateContext: 0xe475c860: maj 2 min 0 rcv 2
  2020-04-23 01:24:00.790 16391-16448/com.example.wafer D/EGL_emulation: eglMakeCurrent: 0xe475c860: ver 2 0 (tinfo 0xec2317c0)
  2020-04-23 01:24:00.827 16391-16448/com.example.wafer D/HostConnection: createUnique: call
  2020-04-23 01:24:00.827 16391-16448/com.example.wafer D/HostConnection: HostConnection::get() New Host Connection established 0xe4699b10, tid 16448
  2020-04-23 01:24:00.834 16391-16391/com.example.wafer W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@f8b56da
  2020-04-23 01:24:00.858 16391-16448/com.example.wafer D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2 
  2020-04-23 01:24:00.858 16391-16448/com.example.wafer E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1
  2020-04-23 01:24:00.940 16391-16443/com.example.wafer V/FA: onActivityCreated
  2020-04-23 01:24:00.988 16391-16391/com.example.wafer W/m.example.wafe: Accessing hidden method Landroid/widget/TextView;-&gt;getTextDirectionHeuristic()Landroid/text/TextDirectionHeuristic; (light greylist, linking)
  2020-04-23 01:24:01.028 16391-16447/com.example.wafer V/FA: Connection attempt already in progress
  2020-04-23 01:24:01.029 16391-16447/com.example.wafer V/FA: Connection attempt already in progress
  2020-04-23 01:24:01.033 16391-16447/com.example.wafer V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 57
  2020-04-23 01:24:01.049 16391-16447/com.example.wafer V/FA: Connection attempt already in progress
  2020-04-23 01:24:01.049 16391-16447/com.example.wafer V/FA: Activity paused, time: 59697960
  2020-04-23 01:24:01.189 16391-16447/com.example.wafer V/FA: Activity resumed, time: 59698486
  2020-04-23 01:24:01.211 16391-16448/com.example.wafer D/EGL_emulation: eglMakeCurrent: 0xe475c860: ver 2 0 (tinfo 0xec2317c0)
  2020-04-23 01:24:01.454 16391-16447/com.example.wafer V/FA: Connection attempt already in progress
  2020-04-23 01:24:01.454 16391-16447/com.example.wafer V/FA: Connection attempt already in progress
  2020-04-23 01:24:01.476 16391-16447/com.example.wafer D/FA: Connected to remote service
  2020-04-23 01:24:01.502 16391-16447/com.example.wafer V/FA: Processing queued up service tasks: 7
  2020-04-23 01:24:01.505 16391-16448/com.example.wafer D/EGL_emulation: eglMakeCurrent: 0xe475c860: ver 2 0 (tinfo 0xec2317c0)
  2020-04-23 01:24:01.527 16391-16453/com.example.wafer D/NetworkSecurityConfig: No Network Security Config specified, using platform default
  2020-04-23 01:24:03.328 16391-16391/com.example.wafer I/AssistStructure: Flattened final assist data: 3128 bytes, containing 1 windows, 10 views
  2020-04-23 01:24:06.825 16391-16447/com.example.wafer V/FA: Inactivity, disconnecting from the service
  2020-04-23 01:24:10.645 16391-16391/com.example.wafer I/AssistStructure: Flattened final assist data: 3192 bytes, containing 1 windows, 10 views
  2020-04-23 01:24:16.381 16391-16391/com.example.wafer I/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzaq@8ae9715
  2020-04-23 01:24:17.676 16391-16414/com.example.wafer D/FirebaseAuth: Notifying id token listeners about user ( 5RulCyqAh7WexMzorDjbhvFMxtu2 ).
  2020-04-23 01:24:17.682 16391-16414/com.example.wafer D/FirebaseAuth: Notifying auth state listeners about user ( 5RulCyqAh7WexMzorDjbhvFMxtu2 ).
  2020-04-23 01:24:17.725 16391-16391/com.example.wafer D/FirebaseAuth: Notifying id token listeners about a sign-out event.
  2020-04-23 01:24:17.725 16391-16391/com.example.wafer D/FirebaseAuth: Notifying auth state listeners about a sign-out event.
  2020-04-23 01:24:17.851 16391-16448/com.example.wafer D/EGL_emulation: eglMakeCurrent: 0xe475c860: ver 2 0 (tinfo 0xec2317c0)
  2020-04-23 01:24:17.998 16391-16391/com.example.wafer I/MyActivity: Name: null
  2020-04-23 01:24:18.315 16391-16448/com.example.wafer D/EGL_emulation: eglMakeCurrent: 0xe475c860: ver 2 0 (tinfo 0xec2317c0)
  </code></pre>