public final class

NativeAdViewHolder

extends Object
java.lang.Object
   ↳ com.google.android.gms.ads.formats.NativeAdViewHolder

Class Overview

View holder for Native Ads which is an alternative way to show Native Ads. Instead of using NativeAdView to show Native Ads, publisher can provide Views owned by the app itself.

Summary

Public Constructors
NativeAdViewHolder(View containerView, Map<String, View> clickableAssetViews, Map<String, View> nonclickableAssetViews)
Construct a NativeAdViewHolder.
Public Methods
void setNativeAd(NativeAd ad)
Sets the NativeAd that this view holder will show.
void unregisterNativeAd()
Dissociate this view holder from the NativeAd it's currently showing.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public NativeAdViewHolder (View containerView, Map<String, View> clickableAssetViews, Map<String, View> nonclickableAssetViews)

Construct a NativeAdViewHolder.

Parameters
containerView View: A container View for the ad. All views in clickableAssetViews and nonclickableAssetViews must be children of this View.
clickableAssetViews Map: The Map of clickable asset names to corresponding View.
nonclickableAssetViews Map: The Map of non-clickable asset names to corresponding View. Pass null if there are no non-clickable Views.

Public Methods

public void setNativeAd (NativeAd ad)

Sets the NativeAd that this view holder will show. Reset to another NativeAd to show a different ad.

Parameters
ad NativeAd: The NativeAd that will be associated to the view holder.

public void unregisterNativeAd ()

Dissociate this view holder from the NativeAd it's currently showing.