Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To allow multiple ad sizes to serve into a banner ad view on Android, use the following methods on BannerAdView:

  • setAdSizes(ArrayList<AdSize> adSizes): Takes a list of the platform ad sizes that may be inserted into the current banner ad view.
  • getAdSizes(): Returns the sizes allowed to be displayed in the current banner ad view.

FIXME: verify example codez

Example:

Code Block
themeEmacs
linenumbersfalse
collapsefalse
// Create the AdView and set its placement ID.
BannerAdView bav = new BannerAdView(this);
bav.setPlacementID("1326299");

// Build up the ad sizes array.
ArrayList<AdSize> sizes = new ArrayList<AdSize>();
sizes.add(new AdSize(300,  50));
sizes.add(new AdSize(300, 250));

// Pass the ad sizes array to the banner ad view.
bav.setAdSizes(sizes);

// Add the AdView to our layout.
FrameLayout layout = (FrameLayout)findViewById(android.R.id.content);
layout.addView(bav);

// Load an ad!
bav.loadAd();

...