/** * Sets URL of the image that should be loaded into this view. Note that calling this will * immediately either set the cached image (if available) or the default image specified by {@link * NetworkImageView#setDefaultImageResId(int)} on the view. * * <p>NOTE: If applicable, {@link NetworkImageView#setDefaultImageResId(int)} and {@link * NetworkImageView#setErrorImageResId(int)} should be called prior to calling this function. * * @param url The URL that should be loaded into this ImageView. * @param imageLoader ImageLoader that will be used to make the request. */ public void setImageUrl(String url, ImageLoader imageLoader) { mUrl = url; mImageLoader = imageLoader; // The URL has potentially changed. See if we need to load it. loadImageIfNecessary(); }
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); loadImageIfNecessary(); }