NativeImageHelper /4.0.0
public class NativeImageHelper
Collection of helper methods to assist with image download and display. Intended for mediation adapter implementations only. Refer to our adapter building instructions for native ads for additional implementation instructions. Do not call this class or associated methods from your app.
Public Methods
public static void /loadImageView(String url, ImageView imageView) /+4.0.0
-
Description: Helper method that takes an image URL and loads the image into an image view.
-
Parameters:
url
: The image URL.imageView
: The image view into which to load the image.
public static void /preCacheImages(Context context, List<String> imageUrls, ImageListener imageListener) /+4.0.0
-
Description: Pre-caches the given set of image URLs. We recommend using this method to warm the image cache before calling
CustomEventNative.CustomEventNativeListener.onNativeAdLoaded(com.mopub.nativeads.BaseNativeAd)
. Doing so will force images to cache before displaying the ad. -
Parameters:
context
: The current context.imageUrls
: A String List of image URLs to be downloaded.imageListener
: Callbacks to inform whether the image downloading has succeeded (viaImageListener.onImagesCached()
) or not (viaImageListener.onImagesFailedToCache(NativeErrorCode
)).
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.)