Example #1
0
 @Override
 protected void onDestroy() {
   if (mInterstitialAd.isLoaded()) {
     mInterstitialAd.show();
   }
   super.onDestroy();
 }
 /** Show interstitial ads when it is ready. Interstitial ads could be null if it is not ready */
 private void showInterstitialAds() {
   if (interstitialAd != null && interstitialAd.isLoaded()) {
     interstitialAd.show();
   } else {
     startButton.setVisibility(View.VISIBLE);
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_collage_editor);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    interstitial = new InterstitialAd(this);
    interstitial.setAdUnitId(getString(R.string.interstitial_ad_unit_id));

    // Create ad request.
    AdRequest adRequest = new AdRequest.Builder().build();

    // Begin loading your interstitial.
    interstitial.loadAd(adRequest);

    Intent i = getIntent();
    imgid = i.getIntExtra("frameId", 0);
    typeId = i.getIntExtra("typeId", 0);

    imgBackground = (ImageView) findViewById(R.id.imgBackground);
    imgBackground.setBackgroundResource(imgid);

    ViewTreeObserver vto = imgBackground.getViewTreeObserver();
    //        vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
    //            @SuppressLint("NewApi")
    //            @SuppressWarnings("deprecation")
    //            @Override
    //            public void onGlobalLayout() {
    //                imgBackgroundWidth = imgBackground.getWidth();
    //                imgBackgroundHeight = imgBackground.getHeight();
    //                GenerateUI();
    //
    //                if (android.os.Build.VERSION.SDK_INT >=
    // android.os.Build.VERSION_CODES.JELLY_BEAN)
    //                    imgBackground.getViewTreeObserver().removeOnGlobalLayoutListener(this);
    //                else
    //                    imgBackground.getViewTreeObserver().removeGlobalOnLayoutListener(this);
    //
    //
    //            }
    //        });

    vto.addOnPreDrawListener(
        new ViewTreeObserver.OnPreDrawListener() {
          public boolean onPreDraw() {
            imgBackgroundWidth = imgBackground.getWidth();
            imgBackgroundHeight = imgBackground.getHeight();
            GenerateUI();

            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN)
              imgBackground.getViewTreeObserver().removeOnPreDrawListener(this);
            else imgBackground.getViewTreeObserver().removeOnPreDrawListener(this);

            return true;
          }
        });

    collageEditorRelativeLayout = (RelativeLayout) findViewById(R.id.collageEditorRelativeLayout);
  }
Example #4
0
  private void showInterstitial() {
    if (interstitial == null) {
      interstitial = new InterstitialAd(this);
      interstitial.setAdUnitId(getResources().getString(R.string.interstitial_unit_id));
      interstitial.setAdListener(
          new AdListener() {
            @Override
            public void onAdLoaded() {
              if (interstitial.isLoaded()) {
                interstitial.show();
                timeForRun = Calendar.getInstance().getTime().getTime();
                numberOfSelectItem = 1;
              }
            }

            @Override
            public void onAdClosed() {}

            @Override
            public void onAdFailedToLoad(int errorCode) {}
          });
    }

    AdRequest adRequest_interstitial = new AdRequest.Builder().build();

    interstitial.loadAd(adRequest_interstitial);
  }
  public void displayInterstitial() {

    if (interstitial.isLoaded()) {
      interstitial.show();
    }
    // else
    // Toast.makeText(this, "Ad did not load", Toast.LENGTH_SHORT).show();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    linearLayout = (LinearLayout) findViewById(R.id.linearLayout);

    adView_1 = new AdView(this);
    adView_1.setAdUnitId("ca-app-pub-2538596252160048/1329783818");
    adView_1.setAdSize(AdSize.BANNER);
    linearLayout.addView(adView_1);

    adView_2 = new AdView(this);
    adView_2.setAdUnitId("ca-app-pub-2538596252160048/1329783818");
    adView_2.setAdSize(AdSize.MEDIUM_RECTANGLE);
    linearLayout.addView(adView_2);

    interstitial = new InterstitialAd(this);
    interstitial.setAdUnitId("ca-app-pub-2538596252160048/1329783818");

    AdRequest adRequest =
        new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("AF8CDE91144F6A31C28629FD2573AB82")
            .build();

    adView_1.setAdListener(
        new AdListener() {
          @Override
          public void onAdLoaded() {
            Log.i("Script", "onAdLoaded()");
          }

          @Override
          public void onAdFailedToLoad(int error) {
            Log.i("Script", "onAdFailedToLoad(" + error + ")");
          }

          @Override
          public void onAdOpened() {
            Log.i("Script", "onAdOpened()");
          }

          @Override
          public void onAdClosed() {
            Log.i("Script", "onAdClosed()");
          }

          @Override
          public void onAdLeftApplication() {
            Log.i("Script", "onAdLeftApplication()");
          }
        });

    adView_1.loadAd(adRequest);
    adView_2.loadAd(adRequest);
    interstitial.loadAd(adRequest);
  }
Example #7
0
 private void showInterstitial() {
   // Show the ad if it's ready. Otherwise toast and reload the ad.
   if (mInterstitialAd != null && mInterstitialAd.isLoaded()) {
     mInterstitialAd.show();
   } else {
     Toast.makeText(this, "Ad did not load", Toast.LENGTH_SHORT).show();
     goToNextLevel();
   }
 }
        @Override
        public void onClick(View v) {

          if (mInterstitialAd.isLoaded()) {
            mInterstitialAd.show();
          } else {
            beginPlayingGame();
          }
        }
Example #9
0
  /** Called when the Show Interstitial button is clicked. */
  public void showInterstitial(View unusedView) {
    // Disable the show button until another interstitial is loaded.

    if (interstitialAd.isLoaded()) {
      interstitialAd.show();
    } else {
      Log.d(LOG_TAG, "Interstitial ad was not ready to be shown.");
    }
  }
Example #10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.learndigits);
    try {

      toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);

      SharedPreferences pref = getSharedPreferences("ASL", Context.MODE_PRIVATE);
      CommonThings.PAID_APP = pref.getString("PAID", "temp");
      if (CommonThings.PAID_APP.equalsIgnoreCase("temp")) {

        AdView adView = (AdView) this.findViewById(R.id.adView);
        AdRequest adRequest =
            new AdRequest.Builder().addTestDevice("A38A51D43110AAD81A8E3AE3AC468C32").build();
        adView.loadAd(adRequest);

        // Interstitials ad

        interstitialAd = new InterstitialAd(this);
        interstitialAd.setAdUnitId(getResources().getString(R.string.interstitialid));
        interstitialAd.loadAd(adRequest);
        interstitialAd.setAdListener(
            new AdListener() {
              @Override
              public void onAdLoaded() {
                // TODO Auto-generated method stub
                DisplayAd();
              }
            });
      }

      //

      btn_nex = (ImageButton) findViewById(R.id.btnForward);
      btn_back = (ImageButton) findViewById(R.id.btnBackward);
      btn_last = (ImageButton) findViewById(R.id.btnNext);
      btn_first = (ImageButton) findViewById(R.id.btnPrevious);
      imageView1 = (ImageView) findViewById(R.id.imageView1);
      tv_hotvines = (TextView) findViewById(R.id.tv_hotvines);
      animationFadeIn = AnimationUtils.loadAnimation(this, R.anim.right_out);

      mp = MediaPlayer.create(this, sounds[curr]);
      mp.start();

      btn_nex.setOnClickListener(this);
      btn_back.setOnClickListener(this);
      btn_first.setOnClickListener(this);
      btn_last.setOnClickListener(this);
      tv_hotvines.setOnClickListener(this);
    } catch (Exception ex) {
      DebugLog.console(ex, "Learn_Digits onCreate Exception");
    }
  }
Example #11
0
  public void tellJoke(View view) {

    // https://developers.google.com/admob/android/interstitial?hl=en
    if (mInterstitialAd.isLoaded()) mInterstitialAd.show();

    EndpointsAsyncTask endpointsAsyncTask = new EndpointsAsyncTask();
    endpointsAsyncTask.setDelegate(this);
    endpointsAsyncTask.execute();
  }
    /**
     * Initialize the interstitial ads
     *
     * @param c
     */
    public void initAds(Context c) {
      interstitialAd = new InterstitialAd(c);
      interstitialAd.setAdUnitId("a15391920065568");
      interstitialAd.setAdListener(adListener);

      AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
      adRequestBuilder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);
      // adRequestBuilder.addTestDevice("D9B017A3983BD8CB8B38C927F7C5E330");
      adRequest = adRequestBuilder.build();
      interstitialAd.loadAd(adRequest);
    }
  private void initInterstitialAd() {
    mInterstitialAd = new InterstitialAd(this);

    /*
      Replace AD_UNIT_ID with your unique Ad Unit ID.
      Please, read official documentation how to obtain one: https://apps.admob.com
    */
    mInterstitialAd.setAdUnitId(AD_UNIT_ID);

    mAdRequest = new AdRequest.Builder().build();

    mInterstitialAd.setAdListener(mInterstitialAdListener);
  }
Example #14
0
  void initAd() {
    // Create an ad.
    interstitialAd = new InterstitialAd(this);
    //		interstitialAd.setAdUnitId(AD_UNIT_ID_INTER);

    // Set the AdListener.
    interstitialAd.setAdListener(
        new AdListener() {
          @Override
          public void onAdLoaded() {
            Log.d(LOG_TAG, "onAdLoaded");
            Toast.makeText(MainActivity.this, "onAdLoaded", Toast.LENGTH_SHORT).show();

            // Change the button text and enable the button.
            interstitialAd.show();
          }

          @Override
          public void onAdFailedToLoad(int errorCode) {
            String message = String.format("onAdFailedToLoad (%s)", getErrorReason(errorCode));
            Log.d(LOG_TAG, message);
            Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show();

            // Change the button text and disable the button.
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // custom start
    // Create the interstitial.
    interstitial = new InterstitialAd(this);
    interstitial.setAdUnitId("ca-app-pub-3701736585096715/2313567381");

    // Create ad request.
    adRequest = new AdRequest.Builder().build();

    // custom end

    setContentView(R.layout.setup_add_account);

    // custom start
    Tracker t =
        ((SyncForICloud) getApplication()).getTracker(SyncForICloud.TrackerName.APP_TRACKER);
    t.setScreenName("Sync for iCloud Contacts: Add Account");
    t.send(new HitBuilders.AppViewBuilder().build());

    // custom end

    if (savedInstanceState == null) { // first call
      getFragmentManager()
          .beginTransaction()
          .add(R.id.right_pane, new LoginEmailFragment())
          .commit();
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_main, container, false);

    mInterstitialAd = new InterstitialAd(getContext());
    mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
    mInterstitialAd.setAdListener(
        new AdListener() {
          @Override
          public void onAdClosed() {
            super.onAdClosed();
            mInterstitialAd.loadAd(getTestAdRequest());
            launchJokeActivity(mJoke);
          }
        });
    mInterstitialAd.loadAd(getTestAdRequest());

    AdView mAdView = (AdView) root.findViewById(R.id.adView);
    mAdView.loadAd(getTestAdRequest());

    final ProgressBar progressBar = (ProgressBar) root.findViewById(R.id.progress_bar);

    Button tellJokeButton = (Button) root.findViewById(R.id.tell_joke_button);
    tellJokeButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            progressBar.setVisibility(View.VISIBLE);
            new FetchJokeAsyncTask()
                .execute(
                    new FetchJokeAsyncTask.FetchJokeTaskCallback() {
                      @Override
                      public void handleJoke(String joke) {
                        mJoke = joke;
                        progressBar.setVisibility(View.GONE);
                        if (mInterstitialAd.isLoaded()) {
                          mInterstitialAd.show();
                        } else {
                          launchJokeActivity(joke);
                        }
                      }
                    });
          }
        });
    return root;
  }
        @Override
        public void onClick(View v) {
          mLoadInterstitialAdButton.setEnabled(false);
          mLoadInterstitialAdButton.setText(
              getResources().getText(R.string.start_load_interstitial_button));

          mInterstitialAd.loadAd(mAdRequest);
        }
Example #18
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test_ad_mob);

    // Create the next level button, which tries to show an interstitial when clicked.
    mNextLevelButton = ((Button) findViewById(R.id.next_level_button));
    mNextLevelButton.setEnabled(false);
    mNextLevelButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            showInterstitial();
          }
        });

    // Create the text view to show the level number.
    mLevelTextView = (TextView) findViewById(R.id.level);
    mLevel = START_LEVEL;

    // Create the InterstitialAd and set the adUnitId (defined in values/strings.xml).
    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
    mInterstitialAd.setAdListener(
        new AdListener() {
          @Override
          public void onAdLoaded() {
            mNextLevelButton.setEnabled(true);
          }

          @Override
          public void onAdFailedToLoad(int errorCode) {
            mNextLevelButton.setEnabled(true);
          }

          @Override
          public void onAdClosed() {
            // Proceed to the next level.
            goToNextLevel();
          }
        });
    loadInterstitial();

    // Toasts the test ad message on the screen. Remove this after defining your own ad unit ID.
    Toast.makeText(this, TOAST_TEXT, Toast.LENGTH_LONG).show();
  }
        @Override
        public void onAdLoaded() {
          mInterstitialAd.show();

          mLoadInterstitialAdButton.setEnabled(true);
          mLoadInterstitialAdButton.setText(
              getResources().getText(R.string.load_interstitial_button));
        }
Example #20
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // https://developers.google.com/admob/android/interstitial?hl=en
    mInterstitialAd = new InterstitialAd(this);
    // hard-coded "test" interstitial add id
    mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
    mInterstitialAd.setAdListener(
        new AdListener() {
          @Override
          public void onAdClosed() {
            requestNewInterstitial();
          }
        });

    requestNewInterstitial();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    MobileAds.initialize(getApplicationContext(), "ca-app-pub-7818455682102414~3747009689");
    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId("ca-app-pub-7818455682102414/8273221287");

    mInterstitialAd.setAdListener(
        new AdListener() {
          @Override
          public void onAdClosed() {
            Log.d("YellowAndDangerous", "onAdClosed");
            requestNewInterstitial();
            showingAd = false;
          }
        });

    requestNewInterstitial();
  }
  public void onCreate(Bundle var1) {
    super.onCreate(var1);
    this.getWindow().addFlags(128);

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.useGL20 = false;
    cfg.useAccelerometer = true;
    cfg.useCompass = false;

    this.requestWindowFeature(1);
    this.getWindow().setFlags(1024, 1024);
    this.getWindow().clearFlags(2048);

    layout = new RelativeLayout(this);
    layout.setLayoutParams(new LayoutParams(-1, -1));

    adView = this.createAdView();
    // layout.addView(adView);
    layout.addView(this.createGameView(cfg));

    this.setContentView(layout);
    this.startAdvertising(adView);

    this.interstitialAd = new InterstitialAd(this);
    this.interstitialAd.setAdUnitId(AD_UNIT_ID_INTERSTITIAL);
    interstitialAd.setAdListener(
        new AdListener() {
          @Override
          public void onAdLoaded() {
            if (DEBUG) {
              Toast.makeText(
                      getApplicationContext(), "Finished Loading Interstitial", Toast.LENGTH_SHORT)
                  .show();
            }
          }

          @Override
          public void onAdClosed() {
            if (DEBUG) {
              Toast.makeText(getApplicationContext(), "Closed Interstitial", Toast.LENGTH_SHORT)
                  .show();
            }
          }
        });

    if (this.gameHelper == null) {
      this.gameHelper = new GameHelper(this, 1);
      this.gameHelper.enableDebugLog(true);
    }

    this.gameHelper.setup(this);
  }
Example #23
0
  /** Called when the Load Interstitial button is clicked. */
  public void loadInterstitial(View unusedView) {
    // Disable the show button until the new ad is loaded.

    // Check the logcat output for your hashed device ID to get test ads on
    // a physical device.
    AdRequest adRequest =
        new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("AC98C820A50B4AD8A2106EDE96FB87D4")
            .build();

    // Load the interstitial ad.
    interstitialAd.loadAd(adRequest);
  }
  @Override
  protected void onPostExecute(String result) {
    super.onPostExecute(result);
    mResult = result;
    // Setting the interstitial ad
    interstitialAd = new InterstitialAd(context);
    interstitialAd.setAdUnitId(context.getString(R.string.interstitial_ad_unit_id));
    interstitialAd.setAdListener(
        new AdListener() {
          @Override
          public void onAdLoaded() {
            super.onAdLoaded();
            if (progressBar != null) {
              progressBar.setVisibility(View.GONE);
            }
            interstitialAd.show();
          }

          @Override
          public void onAdFailedToLoad(int errorCode) {
            super.onAdFailedToLoad(errorCode);
            if (progressBar != null) {
              progressBar.setVisibility(View.GONE);
            }
            startJokeActivity();
          }

          @Override
          public void onAdClosed() {
            startJokeActivity();
          }
        });
    AdRequest ar = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();

    interstitialAd.loadAd(ar);
  }
Example #25
0
  private void loadAdware() {
    // Adware Main Activity
    AdView mAdView = (AdView) findViewById(R.id.adView);

    AdRequest adRequest = new AdRequest.Builder().build();
    /*AdRequest adRequest = new AdRequest.Builder()
    .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
    .addTestDevice("E112885C2D32D31690C7B60F25C89356")
    .addTestDevice("13E7A5DDF2981F979D554ED02BC571B3")
    .build();*/
    mAdView.loadAd(adRequest);

    // Adware interstitial ads
    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId(this.getString(R.string.banner_ad_unit_id));
    /*AdRequest adRequestInterstitialAd = new AdRequest.Builder()
    .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
    .addTestDevice("E112885C2D32D31690C7B60F25C89356")
    .addTestDevice("13E7A5DDF2981F979D554ED02BC571B3")
    .build();*/
    AdRequest adRequestInterstitialAd = new AdRequest.Builder().build();

    mInterstitialAd.loadAd(adRequestInterstitialAd);
  }
Example #26
0
  // https://developers.google.com/admob/android/interstitial?hl=en
  private void requestNewInterstitial() {
    AdRequest adRequest =
        new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();

    mInterstitialAd.loadAd(adRequest);
  }
 // LISTENER
 public void showInterstitial(View view) {
   interstitial.show();
 }
Example #28
0
 private void loadInterstitial() {
   // Disable the next level button and load the ad.
   mNextLevelButton.setEnabled(false);
   AdRequest adRequest = new AdRequest.Builder().build();
   mInterstitialAd.loadAd(adRequest);
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fullimageslider);
    db = new DatabaseHandler(this);
    dbManager = DatabaseManager.INSTANCE;
    dbManager.init(getApplicationContext());
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    options =
        new DisplayImageOptions.Builder()
            .showImageForEmptyUri(R.drawable.ic_launcher)
            .showImageOnFail(R.drawable.ic_launcher)
            .resetViewBeforeLoading(true)
            .cacheOnDisc(true)
            .imageScaleType(ImageScaleType.EXACTLY)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .considerExifParams(true)
            .displayer(new FadeInBitmapDisplayer(300))
            .build();

    setTitle(Constant.CATEGORY_TITLE);
    // Look up the AdView as a resource and load a request.
    mAdView = (AdView) findViewById(R.id.adView);
    mAdView.loadAd(new AdRequest.Builder().build());

    Intent i = getIntent();
    position = i.getIntExtra("POSITION_ID", 0);
    mAllImages = i.getStringArrayExtra("IMAGE_ARRAY");
    mAllImageCatName = i.getStringArrayExtra("IMAGE_CATNAME");

    TOTAL_IMAGE = mAllImages.length - 1;
    viewpager = (ViewPager) findViewById(R.id.image_slider);
    handler = new Handler();

    PinchZoomPageAdapter adapter = new PinchZoomPageAdapter(this, mAllImages, mAllImageCatName);
    viewpager.setAdapter(adapter);
    viewpager.setCurrentItem(position);

    sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    lastUpdate = System.currentTimeMillis();
    mCountPage = 0;
    mInterstitial = new InterstitialAd(this);
    mInterstitial.setAdUnitId(getResources().getString(R.string.admob_publisher_id));
    request = new AdRequest.Builder().addTestDevice("7F0E780CC56F3BA7C1CA7488A61F46BE").build();

    mInterstitial.loadAd(request);
    mInterstitial.setAdListener(
        new AdListener() {
          @Override
          public void onAdClosed() {
            mInterstitial.loadAd(request);
          }
        });
    viewpager.setOnPageChangeListener(
        new OnPageChangeListener() {

          @Override
          public void onPageSelected(int position) {
            // TODO Auto-generated method stub
            mCountPage++;
            Log.d("haipn", "page count:" + mCountPage);
            if (mCountPage >= 20) {

              if (mInterstitial.isLoaded()) {
                mInterstitial.show();
                mCountPage = 0;
              }
            }
            position = viewpager.getCurrentItem();
            Image_Url = mAllImages[position];

            List<Pojo> pojolist = db.getFavRow(Image_Url);
            if (pojolist.size() == 0) {
              menu.getItem(3).setIcon(getResources().getDrawable(R.drawable.fav));
            } else {
              if (pojolist.get(0).getImageurl().equals(Image_Url)) {
                menu.getItem(3).setIcon(getResources().getDrawable(R.drawable.fav_hover));
              }
            }
          }

          @Override
          public void onPageScrolled(int arg0, float arg1, int position) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onPageScrollStateChanged(int position) {
            // TODO Auto-generated method stub

          }
        });
  }
 @Override
 public void onAdClosed() {
   // Proceed to the next level.
   startButton.setVisibility(View.VISIBLE);
   interstitialAd.loadAd(adRequest);
 }