ViewBinder.Builder /2.0

public static final class ViewBinder.Builder

Specifies the binding between the publisher’s layout XML and the native ad assets. Refer to our directions for setting up your native ad layout for usage instructions.

Public Methods

public final Builder ViewBinder.Builder /addExtra(String key, int resourceId) /+2.0

  • Description: Add additional resource bindings via a key and an ID that are not already available via the bindings below. This is typically the case when an ad network might require bindings to ad assets that do not have a MoPub equivalent. Returns the current Builder.

  • Parameters:

    • key: A String key that stands for the resource to be binded.
    • resourceId: An int Android ID pointing to the XML layout for the resource to be binded.

public final Builder ViewBinder.Builder /addExtras(Map<String,Integer> resourceIds) /+2.0

  • Description: Refer to the description for addExtra(String key, int resourceId) with the difference being this method accepts a Map of the <key, ID> bindings.

  • Parameters:

    • resourceIds: A Map<String, Integer> containing the native ad resource mapping.

public final ViewBinder /build() /+2.0

  • Description: Builds the current ViewBinder instance after the bindings below have been specified by the publisher. Returns a new ViewBinder to be built.

  • Parameters: None.

public final ViewBinder.Builder /callToActionId(int callToActionId) /+2.0

  • Description: ID for a Button/ImageView in XML passed in by publishers. To be bound to a native ad call to action asset. Returns the current Builder.

  • Parameters:

    • callToActionId: An int corresponding to the ID of the call to action XML resource.

public final ViewBinder.Builder /iconImageId(int iconImageId) /+2.0

  • Description: ID for an ImageView in XML passed in by publishers. To be bound to a native ad icon image asset. Returns the current Builder.

  • Parameters:

    • iconImageId: An int corresponding to the ID of the icon image XML resource.

public final ViewBinder.Builder /mainImageId(int mediaLayoutId) /+2.0

  • Description: ID for an ImageView in XML passed in by publishers. To be bound to a native ad main image asset. Returns the current Builder.

  • Parameters:

    • mediaLayoutId: An int corresponding to the ID of the main image XML resource.

public final ViewBinder.Builder /privacyInformationIconImageId(int privacyInformationIconImageId) /+4.0.0

  • Description: ID for an ImageView in XML passed in by publishers. To be bound to a native ad privacy information icon asset. Returns the current Builder.

  • Parameters:

    • privacyInformationIconImageId: An int corresponding to the ID of the privacy information icon image XML resource.

public final ViewBinder.Builder /textId(int textId) /+2.0

  • Description: ID for a TextView in XML passed in by publishers. To be bound to a native ad text asset. Returns the current Builder.

  • Parameters:

    • textId: An int corresponding to the ID of the native ad text XML resource.

public final ViewBinder.Builder /titleId(int titleId) /+2.0

  • Description: ID for a TextView in XML passed in by publishers. To be bound to a native ad title asset. Returns the current Builder.

  • Parameters:

    • titleId: An int corresponding to the ID of the native ad title XML resource.

Last updated May 22, 2020

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2020 MoPub (a division of Twitter, Inc.)