java.lang.Object | |
↳ | com.google.android.gms.common.images.ImageManager |
This class is used to load images from the network and handles local caching for you.
Nested Classes | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ImageManager.OnImageLoadedListener | Listener interface for handling when the image for a particular URI has been loaded. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a new ImageManager for loading images from the network.
| |||||||||||
Loads an image to display from a URI.
| |||||||||||
Loads an image to display from the given resource ID.
| |||||||||||
Load an image to display from a URI, using the given resource ID as the default if no image
is found for the given URI.
| |||||||||||
Load an image to display from a URI.
| |||||||||||
Loads an image to display from a URI, using the given resource ID as the default if no image
is found for the given URI.
|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Returns a new ImageManager for loading images from the network.
context | The context used by the ImageManager. |
---|
Loads an image to display from a URI. Note that this does not support arbitrary URIs - the URI must be something that was retrieved from another call to Google Play services.
The image view will be cleared out (the drawable set to null) if the image needs to be loaded asynchronously.
The result (if non-null) is set on the given image view on the main thread.
Note that if the ImageView
used for this call is hosted in a ListAdapter (or any
other class that recycles ImageView
instances), then ALL calls to set the contents of
that ImageView
must be done via one of the calls on this ImageManager
.
imageView | The image view to populate with the image. |
---|---|
uri | URI to load the image data from. |
Loads an image to display from the given resource ID.
If you also useImageManager
s for Views hosted in a ListAdapter (or any
other class that recycles Views instances), then this call should be used rather than
setting the resource directly. This avoids clobbering images when views are recycled.imageView | The image view to populate with the image. |
---|---|
resId | Resource ID to use for the image. |
Load an image to display from a URI, using the given resource ID as the default if no image is found for the given URI. Note that this does not support arbitrary URIs - the URI must be something that was retrieved from another call to Google Play services.
Note that you should hold a reference to the listener provided until the callback is complete. For this reason, the use of anonymous implementations is discouraged.
The result is delivered to the given listener on the main thread.
If a result is not found, the image view will be set to the given default resource if the image needs to be loaded asynchronously.
listener | The listener that is called when the load is complete. |
---|---|
uri | URI to load the image data from. |
defaultResId | Resource ID to use by default for the image. |
Load an image to display from a URI. Note that this does not support arbitrary URIs - the URI must be something that was retrieved from another call to Google Play services.
Note that you should hold a reference to the listener provided until the callback is complete. For this reason, the use of anonymous implementations is discouraged.
The result is delivered to the given listener on the main thread.
listener | The listener that is called when the load is complete. |
---|---|
uri | URI to load the image data from. |
Loads an image to display from a URI, using the given resource ID as the default if no image is found for the given URI. Note that this does not support arbitrary URIs - the URI must be something that was retrieved from another call to Google Play services.
The image view will be set to the given default resource if the image needs to be loaded asynchronously.
The result (if non-null) is set on the given image view on the main thread.
Note that if the ImageView
used for this call is hosted in a ListAdapter (or any
other class that recycles ImageView
instances), then ALL calls to set the contents of
that ImageView
must be done via one of the calls on this ImageManager
.
imageView | The image view to populate with the image. |
---|---|
uri | URI to load the image data from. |
defaultResId | Resource ID to use by default for the image. |