NativeAdViewHolder

public final class NativeAdViewHolder


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

Summary

Public constructors

NativeAdViewHolder(
    View containerView,
    Map<StringView> clickableAssetViews,
    Map<StringView> nonclickableAssetViews
)

Constructs a NativeAdViewHolder.

Public methods

final void

Sets the View that users will use to confirm their clickthroughs.

void

Sets the NativeAd that this view holder will show.

void

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

Public constructors

NativeAdViewHolder

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

Constructs a NativeAdViewHolder.

Parameters
View containerView

A container View for the ad. All views in clickableAssetViews and nonclickableAssetViews must be children of this View.

Map<StringView> clickableAssetViews

The Map of clickable asset names to corresponding .

Map<StringView> nonclickableAssetViews

The Map of non-clickable asset names to corresponding View. Pass null if there are no non-clickable Views.

Public methods

setClickConfirmingView

public final void setClickConfirmingView(View view)

Sets the View that users will use to confirm their clickthroughs.

Parameters
View view

The View to set.

setNativeAd

public void setNativeAd(NativeAd ad)

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

Parameters
NativeAd ad

The NativeAd that will be associated to the view holder.

unregisterNativeAd

public void unregisterNativeAd()

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