|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.view.View
android.view.ViewGroup
android.widget.RelativeLayout
com.google.ads.AdView
public class AdView
The View
that displays the ads.
Sample code:
public class MyActivity extends Activity { private AdView adView; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Create an ad. adView = new AdView(this, AdSize.IAB_BANNER, "adUnitId"); // Create an ad request. AdRequest adRequest = new AdRequest(); // Fill out ad request. // Add the AdView to the view hierarchy. The view will have no size // until the ad is loaded. // Start loading the ad in the background. adView.loadAd(adRequest); } public void onDestroy() { // Destroy the AdView. adView.destroy(); super.onDestroy(); } }
Nested Class Summary |
---|
Nested classes/interfaces inherited from class android.widget.RelativeLayout |
---|
RelativeLayout.LayoutParams |
Nested classes/interfaces inherited from class android.view.ViewGroup |
---|
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener |
Nested classes/interfaces inherited from class android.view.View |
---|
View.BaseSavedState, View.DragShadowBuilder, View.MeasureSpec, View.OnAttachStateChangeListener, View.OnClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnSystemUiVisibilityChangeListener, View.OnTouchListener |
Field Summary |
---|
Fields inherited from class android.widget.RelativeLayout |
---|
ABOVE, ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_LEFT, ALIGN_PARENT_BOTTOM, ALIGN_PARENT_LEFT, ALIGN_PARENT_RIGHT, ALIGN_PARENT_TOP, ALIGN_RIGHT, ALIGN_TOP, BELOW, CENTER_HORIZONTAL, CENTER_IN_PARENT, CENTER_VERTICAL, LEFT_OF, RIGHT_OF, TRUE |
Fields inherited from class android.view.ViewGroup |
---|
FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE |
Constructor Summary | |
---|---|
AdView(Activity activity,
AdSize adSize,
String adUnitId)
Creates an AdView . |
|
AdView(Context context,
AttributeSet attrs)
Creates an AdView from an XML layout. |
|
AdView(Context context,
AttributeSet attrs,
int defStyle)
Creates an AdView from an XML layout. |
Method Summary | |
---|---|
void |
destroy()
Destroys the AdView . |
boolean |
isReady()
See Ad.isReady() . |
boolean |
isRefreshing()
Returns true if the ad is currently automatically refreshing. |
void |
loadAd(AdRequest adRequest)
See Ad.loadAd(AdRequest) . |
void |
setAdListener(AdListener adListener)
See Ad.setAdListener(AdListener) . |
void |
stopLoading()
See Ad.stopLoading() . |
Methods inherited from class android.widget.RelativeLayout |
---|
dispatchPopulateAccessibilityEvent, generateLayoutParams, getBaseline, requestLayout, setGravity, setHorizontalGravity, setIgnoreGravity, setVerticalGravity |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface android.view.ViewParent |
---|
createContextMenu, getParent, isLayoutRequested |
Constructor Detail |
---|
public AdView(Activity activity, AdSize adSize, String adUnitId)
AdView
.
activity
- the associated Activity
.adSize
- the size of the ad.adUnitId
- the ad unit ID.public AdView(Context context, AttributeSet attrs)
AdView
from an XML layout.
context
- the Context
provided when inflating from an XML
layout.attrs
- the AttributeSet
provided when inflating from an XML
layout.public AdView(Context context, AttributeSet attrs, int defStyle)
AdView
from an XML layout.
context
- the Context
provided when inflating from an XML
layout.attrs
- the AttributeSet
provided when inflating from an XML
layout.defStyle
- the default style provided when inflating from an XML
layout.Method Detail |
---|
public void destroy()
AdView
. The AdView
should no longer be used
after this method is called.
public boolean isReady()
Ad.isReady()
.
isReady
in interface Ad
true
if the ad is successfully loaded and is ready to be
shown.Ad.isReady()
public boolean isRefreshing()
true
if the ad is currently automatically refreshing.
true
if the ad is currently automatically refreshing.public void loadAd(AdRequest adRequest)
Ad.loadAd(AdRequest)
.
loadAd
in interface Ad
adRequest
- the AdRequest
used to fetch the ad.Ad.loadAd(AdRequest)
public void setAdListener(AdListener adListener)
Ad.setAdListener(AdListener)
.
setAdListener
in interface Ad
adListener
- the AdListener
.Ad.setAdListener(AdListener)
public void stopLoading()
Ad.stopLoading()
.
stopLoading
in interface Ad
Ad.stopLoading()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |