@Override
 protected void onDestroy() {
   AdsMogoLayout.clear();
   // 清除 adsMogoLayout 实例 所产生用于多线程缓冲机制的线程池
   // 此方法请不要轻易调用,如果调用时间不当,会造成无法统计计数
   adsMogoLayoutCode.clearThread();
   super.onDestroy();
 }
  public AdViewHelper(Cocos2dxActivity activity) {
    com.adsmogo.util.L.debug = true;
    mActivity = activity;

    mLayout = new RelativeLayout(mActivity);

    activity.addContentView(
        mLayout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    AdsMogoLayout adViewLayout =
        new AdsMogoLayout(mActivity, "20d18f3561a34075bcc2514294239317", true);

    // ¶¥²¿¾ÓÖÐ
    RelativeLayout.LayoutParams layoutParams =
        new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    adViewLayout.setLayoutParams(layoutParams);

    mLayout.addView(adViewLayout);
    mLayout.invalidate();

    mHandler =
        new Handler() {
          @Override
          public void handleMessage(Message msg) {
            switch (msg.what) {
              case 1:
                {
                  if (mLayout != null) mLayout.setVisibility(View.VISIBLE);
                  break;
                }
              case 2:
                {
                  if (mLayout != null) mLayout.setVisibility(View.GONE);
                  break;
                }
              default:
                break;
            }
          }
        };
  }