BaseAdView

public abstract class BaseAdView extends ViewGroup
Known Direct Subclasses

The base ad View for displaying banner ads.

XML Attribute Summary

Inherited Constant Summary

Inherited Field Summary

Protected Constructor Summary

BaseAdView(Context context, int adViewType)
Constructs a BaseAdView from code.
BaseAdView(Context context, AttributeSet attrs, int adViewType)
Constructs a BaseAdView from an XML layout.
BaseAdView(Context context, AttributeSet attrs, boolean allowMultipleAdSizes)
Constructs a BaseAdView from an XML layout.
BaseAdView(Context context, AttributeSet attrs, int defStyle, int adViewType)
Constructs a BaseAdView from an XML layout.
BaseAdView(Context context, AttributeSet attrs, int defStyle, int adViewType, boolean allowMultipleAdSizes)
Constructs a BaseAdView from an XML layout.

Public Method Summary

void
destroy()
Destroys the ad view.
AdListener
getAdListener()
Returns the AdListener for this ad view.
AdSize
getAdSize()
Returns the size of the ad.
String
getAdUnitId()
Returns the ad unit ID.
OnPaidEventListener
getOnPaidEventListener()
Gets the OnPaidEventListener for this ad view.
ResponseInfo
getResponseInfo()
Returns the ResponseInfo object for the loaded ad.
boolean
isLoading()
Returns true if the ad is loading.
void
loadAd(AdRequest adRequest)
Loads an ad.
void
pause()
Pauses any extra processing associated with this ad view.
void
resume()
Resumes an ad view after a previous call to pause().
void
setAdListener(AdListener adListener)
Sets an AdListener for this ad view.
void
setAdSize(AdSize adSize)
Sets the size of the ad.
void
setAdUnitId(String adUnitId)
Sets the ad unit ID.
void
setOnPaidEventListener(OnPaidEventListener listener)
Registers a callback to be invoked when this ad is estimated to have earned money.

Protected Method Summary

void
onLayout(boolean changed, int left, int top, int right, int bottom)
void
onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Inherited Method Summary

XML Attributes

AdsAttrs_adSize

AdsAttrs_adUnitId

Protected Constructors

protected BaseAdView (Context context, int adViewType)

Constructs a BaseAdView from code.

Parameters
context The Context the BaseAdView is running in.
adViewType

protected BaseAdView (Context context, AttributeSet attrs, int adViewType)

Constructs a BaseAdView from an XML layout.

protected BaseAdView (Context context, AttributeSet attrs, boolean allowMultipleAdSizes)

Constructs a BaseAdView from an XML layout.

protected BaseAdView (Context context, AttributeSet attrs, int defStyle, int adViewType)

Constructs a BaseAdView from an XML layout.

protected BaseAdView (Context context, AttributeSet attrs, int defStyle, int adViewType, boolean allowMultipleAdSizes)

Constructs a BaseAdView from an XML layout.

Public Methods

public void destroy ()

Destroys the ad view. This method should be called in the parent Activity's Activity.onDestroy() method. No other methods should be called on the ad view after destroy() is called.

public AdListener getAdListener ()

Returns the AdListener for this ad view.

public AdSize getAdSize ()

Returns the size of the ad. Returns null if setAdSize(AdSize) hasn't been called yet.

public String getAdUnitId ()

Returns the ad unit ID.

public OnPaidEventListener getOnPaidEventListener ()

Gets the OnPaidEventListener for this ad view.

public ResponseInfo getResponseInfo ()

Returns the ResponseInfo object for the loaded ad. Returns null until the ad successfully loads.

public boolean isLoading ()

Returns true if the ad is loading.

public void loadAd (AdRequest adRequest)

Loads an ad.

Throws
IllegalStateException If the size of the ad or the ad unit ID have not been set.

public void pause ()

Pauses any extra processing associated with this ad view. This method should be called in the parent Activity's Activity.onPause() method.

public void resume ()

Resumes an ad view after a previous call to pause(). This method should be called in the parent Activity's Activity.onResume() method.

public void setAdListener (AdListener adListener)

Sets an AdListener for this ad view.

public void setAdSize (AdSize adSize)

Sets the size of the ad.

Throws
IllegalStateException If the size of the ad was already set.

public void setAdUnitId (String adUnitId)

Sets the ad unit ID.

Throws
IllegalStateException If the ad unit ID was already set.

public void setOnPaidEventListener (OnPaidEventListener listener)

Registers a callback to be invoked when this ad is estimated to have earned money.

Protected Methods

protected void onLayout (boolean changed, int left, int top, int right, int bottom)

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

Attribute Name
AdsAttrs_adSize
AdsAttrs_adUnitId