无限循环(在启动停止方法时)

时间:2019-07-08 21:58:32

标签: java android firebase onstart

为什么我在主活动和登录活动之间无休止地循环?

    @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);
        }

    }

以上代码是否可以接受?

0 个答案:

没有答案