title: android.view.WindowLeaked / Android Intent
body: <p>When I run below codes I get this error message : &quot;020-11-07 18:45:26.737 20684-20684/com.user.example E/WindowManager: android.view.WindowLeaked: Activity com.user.example.Pages.Dashboard.Home has leaked window DecorView@14fe64f[Home] that was originally added here&quot; but my application still run without crash. How can I fix that problem _</p>
  <p>These codes belong to an activity.</p>
  <pre><code>  public void login(View v) {
      if( !validateUserEmail() | !validatePassword()){
          return;
      }
      UserInfo userInfo = new UserInfo(mail,password);
      SendRequestToAPI.sendRequest(userInfo,Login.this);
  }
  </code></pre>
  <p>These codes belong to a class which name is SendRequestToAPI.</p>
  <pre><code>public static void showWarningAlert(final Context context, String title, 
  String contentText, String confirmText){
          SweetAlertDialog alertDialog = new 
          SweetAlertDialog(context,SweetAlertDialog.WARNING_TYPE);
          alertDialog.setTitle(title);
          alertDialog.setContentText(contentText);
          alertDialog.setConfirmText(confirmText);
          alertDialog.setConfirmClickListener(new 
          SweetAlertDialog.OnSweetClickListener() {
              @Override
              public void onClick(SweetAlertDialog sweetAlertDialog) {
                  Intent intent = new Intent(context, Login.class);
                  context.startActivity(intent);
                  ((Activity)context).finish();
              }
          }).setCancelButton(&quot;Cancel&quot;, new 
          SweetAlertDialog.OnSweetClickListener() {
                      @Override
                      public void onClick(SweetAlertDialog sweetAlertDialog) {
                          sweetAlertDialog.dismissWithAnimation();
                      }
                  })
                  .show();
  
      }
  </code></pre>