# Class AdListener

java.lang.Object
com.codename1.ads.AdListener

public class AdListener extends Object

Receives the lifecycle events of an ad. This is an adapter class with empty implementations so you only override the events you care about:

    interstitial.setAdListener(new AdListener() {
        public void onDismissed() {
            // resume gameplay
        }
    });

Every callback is delivered on the Codename One EDT, so it is safe to touch the UI directly. The model is fully event driven; there is never a need to poll `AbstractFullScreenAd.isLoaded()` in a loop.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AdListener()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onClicked()`
  Invoked when the user clicked the ad.
  `void`
  `onDismissed()`
  Invoked when the full screen ad was dismissed and the app regained focus.
  `void`
  `onFailedToLoad(AdError error)`
  Invoked when the ad failed to load.
  `void`
  `onImpression()`
  Invoked when an impression was recorded for the ad.
  `void`
  `onLoaded()`
  Invoked when the ad finished loading and is ready to be shown.
  `void`
  `onShowFailed(AdError error)`
  Invoked when the ad failed to present.
  `void`
  `onShown()`
  Invoked when the ad was presented full screen (or rendered, for banners).

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AdListener

    public AdListener()

- ## Method Details

  - ### onLoaded

    public void onLoaded()
    Invoked when the ad finished loading and is ready to be shown.

  - ### onFailedToLoad

    public void onFailedToLoad(AdError error)

    Invoked when the ad failed to load.

    ###### Parameters

    - `error`: the failure description

  - ### onShown

    public void onShown()
    Invoked when the ad was presented full screen (or rendered, for banners).

  - ### onShowFailed

    public void onShowFailed(AdError error)

    Invoked when the ad failed to present.

    ###### Parameters

    - `error`: the failure description

  - ### onDismissed

    public void onDismissed()
    Invoked when the full screen ad was dismissed and the app regained focus. This is the right place to load the next ad and resume the app.

  - ### onImpression

    public void onImpression()
    Invoked when an impression was recorded for the ad.

  - ### onClicked

    public void onClicked()
    Invoked when the user clicked the ad.