public class

ImageUrlLabel

extends View
java.lang.Object
   ↳ com.neomades.ui.View
     ↳ com.neomades.content.image.ImageUrlLabel

Class Overview

Handles fetching an image from a URL as well as the life-cycle of the associated request.

The URL will be loaded when the View become visible, and image request will be cancelled if the View become hidden or the URL has been replaced.

See Also

Summary

[Expand]
Inherited XML Attributes
From class com.neomades.ui.View
[Expand]
Inherited Constants
From interface com.neomades.ui.Alignment
From interface com.neomades.ui.StretchMode
Public Constructors
ImageUrlLabel()
Creates an ImageLabel with URL and ImageLoader
Public Methods
void setDefaultImage(int defaultImage)
Sets the default image resource ID to be used for this view until the attempt to load it completes.
void setErrorImage(int errorImage)
Sets the error image resource ID to be used for this view in the event that the image requested fails to load.
void setImageScaleType(int scaleType)
Set the scale type for the image contained into this button.
void setImageUrl(String url, ImageLoader imageLoader)
Sets URL of the image that should be loaded into this view.
[Expand]
Inherited Methods
From class com.neomades.ui.View
From class java.lang.Object

Public Constructors

public ImageUrlLabel ()

Creates an ImageLabel with URL and ImageLoader

Public Methods

public void setDefaultImage (int defaultImage)

Sets the default image resource ID to be used for this view until the attempt to load it completes.

>NOTE: If applicable, setDefaultImage(int) should be called prior to calling setImageUrl(String, ImageLoader).

Parameters
defaultImage resource identifier used by setImageUrl(String, ImageLoader) when the loader loads the URL.
See Also

public void setErrorImage (int errorImage)

Sets the error image resource ID to be used for this view in the event that the image requested fails to load.

>NOTE: If applicable, setErrorImage(int) should be called prior to calling setImageUrl(String, ImageLoader).

Parameters
errorImage resource identifier used by setImageUrl(String, ImageLoader) when the loader has failed loading the URL.
See Also

public void setImageScaleType (int scaleType)

Set the scale type for the image contained into this button.

By default, the scale type is STRETCH.

Parameters
scaleType the scale type to apply to the image of the ImageLabel
See Also

public void setImageUrl (String url, ImageLoader imageLoader)

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 setDefaultImage(int) on the view.

If this function is called many times with different URLs, older url loads are cancelled. Setting URL to null will cancel the previous url loading.

NOTE: If applicable, setDefaultImage(int) and setErrorImage(int) should be called prior to calling this function.

Parameters
url The URL that should be loaded into this ImageView.
imageLoader ImageLoader that will be used to make the request.