code: public void attach(ViewGroup.LayoutParams layoutParams) {
          if(systemOverlay) {
              try {
                  getWindowManager().addView(this, layoutParams);
              }
              catch(SecurityException e) {
                  throw new SecurityException("Your application must have SYSTEM_ALERT_WINDOW " +
                          "permission to create a system window.");
              }
          }
          else {
              ((ViewGroup) getActivityContentView()).addView(this, layoutParams);
          }
      }
docs: Attaches it to the content view with specified LayoutParams.
  @param layoutParams