public interface MoPubAdRenderer<T extends BaseNativeAd>
An interface for creating ad views and rendering them using ad data. Normally you will use the subclass
ViewBinder to customize your ad view with your own layout. However, to programmatically create or manage your ad view, you can implement
public View /createAdView(Context context, ViewGroup parent) /+2.4.0
Description: Creates a new view to be used as an ad. This method is called when you call
MoPubStreamAdPlacer.getAdView(int position, View convertView, ViewGroup parent)and the
convertViewis null. You must return a valid view. Returns a new ad view.
context: The context. Useful for creating a view. This is recommended to be an Activity. If you have custom themes defined in your Activity, not passing in that Activity will result in the default Application theme being used when creating the ad view.
parent: The parent that the view will eventually be attached to. You might use the parent to determine layout parameters, but should return the view without attaching it to the parent.
public void /renderAdView(View view, T ad) /+2.4.0
Description: Renders a view created by
createAdView(android.content.Context, android.view.ViewGroup)by filling it with ad data.
view: The ad View.
ad: The ad data that should be bound to the view.
/Tis a type parameter of the ad payload type.
public boolean /supports(BaseNativeAd nativeAd) /+4.0.0
Description: Determines if this renderer supports the type of native ad passed in. Returns
trueif the renderer can render the native ad;
falseif it cannot.
nativeAd: The native ad to render.
Last updated December 03, 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.)