title: Firebase Auth getCurrent user returns true for != null even though the user is not logged in! here i want to change intent only once user logs in
body: <pre><code>        import com.firebase.client.Firebase;
          import com.google.android.gms.tasks.OnCompleteListener;
          import com.google.android.gms.tasks.Task;
          import com.google.firebase.auth.AuthResult;
          import com.google.firebase.auth.FirebaseAuth;
  
          public class MainActivity extends AppCompatActivity {
  
              private ImageButton mSendata;
              private Firebase mRef; // database connection
              private FirebaseAuth mAuth;
              private TextView email;
              private TextView password;
              private FirebaseAuth.AuthStateListener mAuthListener;
  
              @Override
    //runs when activity created
              protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  mAuth = FirebaseAuth.getInstance();
                  setContentView(R.layout.activity_main);
                  email = (TextView) findViewById(R.id.email);
                  password = (TextView) findViewById(R.id.password);
                  mRef = new Firebase("https://notifyme-dfed3.firebaseio.com/");
                  mSendata = (ImageButton) findViewById(R.id.imageButton);
      // Auth change method
                  mAuthListener = new FirebaseAuth.AuthStateListener() {
                      public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
  </code></pre>
  
  <p>// having problem here----------------------------------------------------- </p>
  
  <pre><code>                        if (firebaseAuth.getCurrentUser() != null) {
  
                              startActivity(new Intent(MainActivity.this, AccountActivity.class));
                          }
  
  
                      }
  
  
                  };
  </code></pre>
  
  <p>//--------------------end-- please check within comments------------------------------------------------</p>
  
  <pre><code>                mSendata.setOnClickListener(
                      new View.OnClickListener() {
                          @Override
                          public void onClick(View v) {
                              startSignIn(); //calls sign in method when user clicks button
  
                          }
  
  
                      });
              }
  
              protected void onStart() {
                  super.onStart();
                  mAuth.addAuthStateListener(mAuthListener);
              }
  </code></pre>
  
  <p>//This method signs in the user</p>
  
  <pre><code>            public void startSignIn() {
  
  
                  String emails = email.getText().toString();/* gets user input*/
                  String passwords = password.getText().toString();
  </code></pre>
  
  <p>// check if fields are empty</p>
  
  <pre><code>                if (TextUtils.isEmpty(emails) || TextUtils.isEmpty(passwords)) {
                      Toast.makeText(MainActivity.this, "Fields are empty", Toast.LENGTH_LONG).show();
  
  
                  } else {
                      mAuth.signInWithEmailAndPassword(emails, passwords).addOnCompleteListener(new OnCompleteListener &lt; AuthResult &gt; () {
                          @Override
                          public void onComplete(@NonNull Task &lt; AuthResult &gt; task) {                       /* if task not success show dialog
  
                              if (!task.isSuccessful()) {
  
                                  Toast.makeText(MainActivity.this, "Sign in Problem", Toast.LENGTH_LONG).show();
                              }
  
  
                          }
                      });
  
                  }
              }
  
  
          }// end of code
  </code></pre>