用户通过身份验证后,活动将多次启动

成功验证用户身份后,第二个活动将启动多次。我已经在Volley get-Request中调用了意图,该意图在使用电子邮件和密码请求登录Firebase的on success方法中更进一步。

I have tried adding the flag FLAG_ACTIVITY_REORDER_TO_FRONT as suggested here,however it still launches multiple times.

这是我认为错误可能所在的代码(这些只是部分代码,而不是整个代码)

auth.signInWithEmailAndPassword(u, p)
   addOnCompleteListener(Login.this, new OnCompleteListener<AuthResult>() {
   @Override
   public void onComplete(@NonNull Task<AuthResult> task) {
        if (task.isSuccessful()) {
                     getdata();
                      }
          }

public void getdata() 
  {
   JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET,URL, null,
      new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {

          //Getting data from response

          Intent intent = new Intent(Login.this,Activity2.class);
          intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
          startActivity(intent);
          finish();
    }
  requestQueue.add(jsonObjectRequest);
    }

如何确保Activity2仅启动一次?您还能解释为什么会这样吗?