MoPubStaticNativeAdRenderer /4.0.0

public class MoPubStaticNativeAdRenderer implements MoPubAdRenderer<StaticNativeAd>

An implementation of MoPubAdRenderer for rendering native ads.

Public Methods

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 convertView is null. You must return a valid view. Returns a new ad view.

  • Parameters:

    • 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

public boolean /supports(BaseNativeAd nativeAd) /+4.0.0

  • Description: Determines if this renderer supports the type of native ad passed in. Returns true if the renderer can render the native ad; false if it cannot.

  • Parameters:

    • nativeAd: The native ad to render.

Last updated August 28, 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.)