Summary: Ctors | Methods | Inherited Methods | [Expand All]
public static class

# AdLoader.Builder

extends Object

java.lang.Object
↳ | com.google.android.gms.ads.AdLoader.Builder

## Class Overview

Builder for a `AdLoader`.

## Summary

Public Constructors
| AdLoader.Builder(Context context, String adUnitID) Creates a new `AdLoader.Builder` for constructing an `AdLoader`.

Public Methods
AdLoader | build()
AdLoader.Builder | forAppInstallAd(NativeAppInstallAd.OnAppInstallAdLoadedListener listener)
AdLoader.Builder | forContentAd(NativeContentAd.OnContentAdLoadedListener listener)
AdLoader.Builder | forCustomTemplateAd(String templateId, NativeCustomTemplateAd.OnCustomTemplateAdLoadedListener adLoadedListener, NativeCustomTemplateAd.OnCustomClickListener customClickListener)
AdLoader.Builder | withAdListener(AdListener listener)
AdLoader.Builder | withCorrelator(Correlator correlator)
AdLoader.Builder | withNativeAdOptions(NativeAdOptions options)

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Public Constructors

#### public AdLoader.Builder (Context context, String adUnitID)

Creates a new `AdLoader.Builder` for constructing an `AdLoader`.

##### Parameters

context | The context.
adUnitID | The ad unit ID.

## Public Methods

#### public AdLoader build ()

##### Returns

- A `AdLoader` or null if there was an error was encountered..

#### public AdLoader.Builder forAppInstallAd (NativeAppInstallAd.OnAppInstallAdLoadedListener listener)

##### Parameters

listener | An object that handles displaying native app install ads.

#### public AdLoader.Builder forContentAd (NativeContentAd.OnContentAdLoadedListener listener)

##### Parameters

listener | An object that handles displaying native content ads.

#### public AdLoader.Builder forCustomTemplateAd (String templateId, NativeCustomTemplateAd.OnCustomTemplateAdLoadedListener adLoadedListener, NativeCustomTemplateAd.OnCustomClickListener customClickListener)

##### Parameters

templateId | Custom template Id defined in the DFP front end.
adLoadedListener | An object that handles displaying native custom template ads.
customClickListener | An optional listener that handles custom clicks on custom template ads.

#### public AdLoader.Builder withAdListener (AdListener listener)

##### Parameters

listener | An object that handles errors encountered when retrieving native ads.

#### public AdLoader.Builder withCorrelator (Correlator correlator)

##### Parameters

correlator | A `Correlator` to attach with this loader. This parameter cannot be null.

#### public AdLoader.Builder withNativeAdOptions (NativeAdOptions options)

##### Parameters

options | An object that specifies various native ad options.