Back to project page android-weather-demo-application.
The source code is released under:
GNU General Public License
If you think the Android project android-weather-demo-application listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.openweathermap.volley.provider; /* www. j ava 2 s. co m*/ import org.openweathermap.WeatherApplication; import android.graphics.Bitmap; import android.support.v4.util.LruCache; import com.android.volley.toolbox.ImageLoader; /** * A helper class that sets up an ImageLoader object based * on the provided URL. This image loader can be provided to * a NetworkImageView to load a Bitmap from the specified URL * @author samkirton */ public class VolleyImageLoader { private String mUrl; private ImageLoader mImageLoader; public String getUrl() { return mUrl; } public ImageLoader getImageLoader() { return mImageLoader; } /** * Setup an ImageLoader object to be used with a NetworkImageView * @param url The URL where the bitmap resides */ public VolleyImageLoader(String url) { mUrl = url; mImageLoader = new ImageLoader( WeatherApplication.getInstance().getRequestQueue(), new ImageLoader.ImageCache() { private final LruCache<String, Bitmap> mCache = new LruCache<String, Bitmap>(10); public void putBitmap(String url, Bitmap bitmap) { mCache.put(url, bitmap); } public Bitmap getBitmap(String url) { return mCache.get(url); } } ); } }