public class MoPubStaticNativeAdRenderer implements MoPubAdRenderer<StaticNativeAd>
An implementation of
MoPubAdRenderer for rendering native ads.
public View /createAdView(Context context, ViewGroup parent) /+4.0.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, StaticNativeAd staticNativeAd) /+4.0.0
Description: Renders a view created by
createAdView(android.content.Context, android.view.ViewGroup)by filling it with ad data.
view: The ad View.
staticNativeAd: The ad data that should be bound to the view.
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.
How can we make this article better for you?
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.)