0

Why am I getting an endless loop between the main activity and login activity?

    @Override
    protected void onStart() {
        super.onStart();
        if (mAuthListener == null) {
            //removeAuthSateListner is used in onStart function just for checking purposes, it helps in logging you out.
            startActivity(new Intent(this, LoginActivity.class));
        } else
            startActivity(new Intent(this, EditProfileActivity.class));
    }

    @Override
    protected void onStop() {
        super.onStop();
        if (mAuthListener != null) {
            mAuth.removeAuthStateListener(mAuthListener);
        }
    }

Is this code correct?

Sergey Emeliyanov
  • 5,158
  • 6
  • 29
  • 52
Amer Anajjem
  • 133
  • 1
  • 9

0 Answers0