如何完成儿童活动android

时间:2016-12-24 04:28:02

标签: android

登录活动

mGoogleBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(LoginActivity.this, "1", Toast.LENGTH_LONG).show();

                Intent intent = new Intent(LoginActivity.this, GoogleAuthentication.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                startActivity(intent);
            }
        });

然后在我的GoogleAuthentication活动中,在oncreate中调用googleSignIn方法

  private void googleSignIn() {
        Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
        startActivityForResult(signInIntent, GOOGLE_RC_SIGN_IN);
    }

根据这种方法,我试图杀死我的孩子活动,但它没有被杀死

 @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == GOOGLE_RC_SIGN_IN) {
            GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);

            if (result.isSuccess()) {
                GoogleSignInAccount account = result.getSignInAccount();
                firebaseAuthWithGoogle(account);
            }else {
                finishActivity(requestCode);
                this.finish();
                Intent intent = new Intent(GoogleAuthentication.this, LoginActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                startActivity(intent);
                Toast.makeText(GoogleAuthentication.this, "Google Authentication Failed", Toast.LENGTH_LONG).show();
            }
        }
    }

当我按下按钮时,我希望这个孩子活动被杀死....现在,它没有被杀死,当我打开另一个活动时,这个谷歌标志意图活动再次出现。

请帮忙,为你节省时间。

0 个答案:

没有答案