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 currentBuilder
. -
Parameters:
key
: AString
key that stands for the resource to be binded.resourceId
: Anint
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
: AMap<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 newViewBinder
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 currentBuilder
. -
Parameters:
callToActionId
: Anint
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 currentBuilder
. -
Parameters:
iconImageId
: Anint
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 currentBuilder
. -
Parameters:
mediaLayoutId
: Anint
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 currentBuilder
. -
Parameters:
privacyInformationIconImageId
: Anint
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 currentBuilder
. -
Parameters:
textId
: Anint
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 currentBuilder
. -
Parameters:
titleId
: Anint
corresponding to the ID of the native ad title XML resource.
Last updated March 30, 2021
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.
© 2021 MoPub (a division of Twitter, Inc.)