Codota Logo
ImageLoader
Code IndexAdd Codota to your IDE (free)

How to use
ImageLoader
in
com.android.volley.toolbox

Best Java code snippets using com.android.volley.toolbox.ImageLoader (Showing top 20 results out of 378)

  • Common ways to obtain ImageLoader
private void myMethod () {
ImageLoader i =
  • Codota IconRequestQueue queue;ImageLoader.ImageCache imageCache;new ImageLoader(queue, imageCache)
  • Smart code suggestions by Codota
}
origin: commonsguy/cw-omnibus

 void loadImage(String url, ImageView iv,
         int placeholderDrawable, int errorDrawable) {
  imageLoader.get(url,
   ImageLoader.getImageListener(iv, placeholderDrawable,
    errorDrawable));
 }
}
origin: mcxiaoke/android-volley

@Before
public void setUp() {
  mRequestQueue = mock(RequestQueue.class);
  mImageCache = mock(ImageLoader.ImageCache.class);
  mImageLoader = new ImageLoader(mRequestQueue, mImageCache);
}
origin: mcxiaoke/android-volley

/**
 * Checks if the item is available in the cache.
 * @param requestUrl The url of the remote image
 * @param maxWidth The maximum width of the returned image.
 * @param maxHeight The maximum height of the returned image.
 * @return True if the item exists in cache, false otherwise.
 */
public boolean isCached(String requestUrl, int maxWidth, int maxHeight) {
  return isCached(requestUrl, maxWidth, maxHeight, ScaleType.CENTER_INSIDE);
}
origin: mcxiaoke/android-volley

/**
 * Checks if the item is available in the cache.
 *
 * @param requestUrl The url of the remote image
 * @param maxWidth   The maximum width of the returned image.
 * @param maxHeight  The maximum height of the returned image.
 * @param scaleType  The scaleType of the imageView.
 * @return True if the item exists in cache, false otherwise.
 */
public boolean isCached(String requestUrl, int maxWidth, int maxHeight, ScaleType scaleType) {
  throwIfNotOnMainThread();
  String cacheKey = getCacheKey(requestUrl, maxWidth, maxHeight, scaleType);
  return mCache.getBitmap(cacheKey) != null;
}
origin: chentao0707/SimplifyReader

throwIfNotOnMainThread();
final String cacheKey = getCacheKey(requestUrl, maxWidth, maxHeight, scaleType);
Request<Bitmap> newRequest = makeImageRequest(requestUrl, maxWidth, maxHeight, scaleType,
    cacheKey);
origin: jiangqqlmj/FastDev4Android

case R.id.btn_image_loader:
  ImageLoader imageLoader=new ImageLoader(requestQueue, new Fdv_ImageCache());
  tv_result.setVisibility(View.GONE);
  img_result.setVisibility(View.VISIBLE);
  img_result_network.setVisibility(View.GONE);
  ImageLoader.ImageListener listener=ImageLoader.getImageListener(img_result,R.drawable.ic_loading,R.drawable.ic_loading);
  imageLoader.get("http://interface.zttmall.com//Images//upload//image//20150328//20150328105404_2392.jpg", listener);
  break;
case R.id.btn_image_network:
  ImageLoader network_imageLoader=new ImageLoader(requestQueue, new Fdv_ImageCache());
  img_result.setVisibility(View.GONE);
  tv_result.setVisibility(View.GONE);
origin: chentao0707/SimplifyReader

/**
 * Returns an ImageContainer for the requested URL.
 *
 * The ImageContainer will contain either the specified default bitmap or the loaded bitmap.
 * If the default was returned, the {@link com.android.volley.toolbox.ImageLoader} will be invoked when the
 * request is fulfilled.
 *
 * @param requestUrl The URL of the image to be loaded.
 */
public ImageContainer get(String requestUrl, final ImageListener listener) {
  return get(requestUrl, listener, 0, 0);
}
origin: mcxiaoke/android-volley

  @Override
  public void onErrorResponse(VolleyError error) {
    onGetImageError(cacheKey, error);
  }
});
origin: mcxiaoke/android-volley

/**
 * Handler for when an image failed to load.
 * @param cacheKey The cache key that is associated with the image request.
 */
protected void onGetImageError(String cacheKey, VolleyError error) {
  // Notify the requesters that something failed via a null result.
  // Remove this request from the list of in-flight requests.
  BatchedImageRequest request = mInFlightRequests.remove(cacheKey);
  if (request != null) {
    // Set the error for this request
    request.setError(error);
    // Send the batched response
    batchResponse(cacheKey, request);
  }
}
origin: chentao0707/SimplifyReader

  @Override
  public void onResponse(Bitmap response) {
    onGetImageSuccess(cacheKey, response);
  }
}, maxWidth, maxHeight, scaleType, Config.RGB_565, new ErrorListener() {
origin: mcxiaoke/android-volley

  @Test
  public void publicMethods() throws Exception {
    // Catch API breaking changes.
    ImageLoader.getImageListener(null, -1, -1);
    mImageLoader.setBatchedResponseDelay(1000);

    assertNotNull(ImageLoader.class.getConstructor(RequestQueue.class,
        ImageLoader.ImageCache.class));

    assertNotNull(ImageLoader.class.getMethod("getImageListener", ImageView.class,
        int.class, int.class));
    assertNotNull(ImageLoader.class.getMethod("isCached", String.class, int.class, int.class));
    assertNotNull(ImageLoader.class.getMethod("isCached", String.class, int.class, int.class,
        ImageView.ScaleType.class));
    assertNotNull(ImageLoader.class.getMethod("get", String.class,
        ImageLoader.ImageListener.class));
    assertNotNull(ImageLoader.class.getMethod("get", String.class,
        ImageLoader.ImageListener.class, int.class, int.class));
    assertNotNull(ImageLoader.class.getMethod("get", String.class,
        ImageLoader.ImageListener.class, int.class, int.class, ImageView.ScaleType.class));
    assertNotNull(ImageLoader.class.getMethod("setBatchedResponseDelay", int.class));

    assertNotNull(ImageLoader.ImageListener.class.getMethod("onResponse",
        ImageLoader.ImageContainer.class, boolean.class));
  }
}
origin: mcxiaoke/android-volley

throwIfNotOnMainThread();
final String cacheKey = getCacheKey(requestUrl, maxWidth, maxHeight, scaleType);
Request<Bitmap> newRequest = makeImageRequest(requestUrl, maxWidth, maxHeight, scaleType,
    cacheKey);
origin: xuningjack/AndroidNet

  /**
   * 增加缓存加载图片
   * @param url
   */
  private void loadImageWithCache(String url){
    ImageLoader imageLoader = new ImageLoader(MyApplication.getHttpRequestQueue(),
        new BitmapCache());
    ImageLoader.ImageListener listener = imageLoader.getImageListener(mImageView,
        R.drawable.ic_launcher, R.drawable.ic_launcher);
    imageLoader.get(url, listener);

  }
}
origin: chentao0707/SimplifyReader

/**
 * Equivalent to calling {@link #get(String, com.android.volley.toolbox.ImageLoader.ImageListener, int, int, android.widget.ImageView.ScaleType)} with
 * {@code Scaletype == ScaleType.CENTER_INSIDE}.
 */
public ImageContainer get(String requestUrl, ImageListener imageListener,
    int maxWidth, int maxHeight) {
  return get(requestUrl, imageListener, maxWidth, maxHeight, ScaleType.CENTER_INSIDE);
}
origin: chentao0707/SimplifyReader

/**
 * Checks if the item is available in the cache.
 *
 * @param requestUrl The url of the remote image
 * @param maxWidth   The maximum width of the returned image.
 * @param maxHeight  The maximum height of the returned image.
 * @param scaleType  The scaleType of the imageView.
 * @return True if the item exists in cache, false otherwise.
 */
public boolean isCached(String requestUrl, int maxWidth, int maxHeight, ScaleType scaleType) {
  throwIfNotOnMainThread();
  String cacheKey = getCacheKey(requestUrl, maxWidth, maxHeight, scaleType);
  return mCache.getBitmap(cacheKey) != null;
}
origin: chentao0707/SimplifyReader

  @Override
  public void onErrorResponse(VolleyError error) {
    onGetImageError(cacheKey, error);
  }
});
origin: chentao0707/SimplifyReader

/**
 * Handler for when an image failed to load.
 * @param cacheKey The cache key that is associated with the image request.
 */
protected void onGetImageError(String cacheKey, VolleyError error) {
  // Notify the requesters that something failed via a null result.
  // Remove this request from the list of in-flight requests.
  BatchedImageRequest request = mInFlightRequests.remove(cacheKey);
  if (request != null) {
    // Set the error for this request
    request.setError(error);
    // Send the batched response
    batchResponse(cacheKey, request);
  }
}
origin: mcxiaoke/android-volley

  @Override
  public void onResponse(Bitmap response) {
    onGetImageSuccess(cacheKey, response);
  }
}, maxWidth, maxHeight, scaleType, Config.RGB_565, new ErrorListener() {
origin: jiangqqlmj/FastDev4Android

  @Test
  public void publicMethods() throws Exception {
    // Catch API breaking changes.
    ImageLoader.getImageListener(null, -1, -1);
    mImageLoader.setBatchedResponseDelay(1000);

    assertNotNull(ImageLoader.class.getConstructor(RequestQueue.class,
        ImageLoader.ImageCache.class));

    assertNotNull(ImageLoader.class.getMethod("getImageListener", ImageView.class,
        int.class, int.class));
    assertNotNull(ImageLoader.class.getMethod("isCached", String.class, int.class, int.class));
    assertNotNull(ImageLoader.class.getMethod("isCached", String.class, int.class, int.class,
        ImageView.ScaleType.class));
    assertNotNull(ImageLoader.class.getMethod("get", String.class,
        ImageLoader.ImageListener.class));
    assertNotNull(ImageLoader.class.getMethod("get", String.class,
        ImageLoader.ImageListener.class, int.class, int.class));
    assertNotNull(ImageLoader.class.getMethod("get", String.class,
        ImageLoader.ImageListener.class, int.class, int.class, ImageView.ScaleType.class));
    assertNotNull(ImageLoader.class.getMethod("setBatchedResponseDelay", int.class));

    assertNotNull(ImageLoader.ImageListener.class.getMethod("onResponse",
        ImageLoader.ImageContainer.class, boolean.class));
  }
}
origin: jiangqqlmj/FastDev4Android

throwIfNotOnMainThread();
final String cacheKey = getCacheKey(requestUrl, maxWidth, maxHeight, scaleType);
Request<Bitmap> newRequest = makeImageRequest(requestUrl, maxWidth, maxHeight, scaleType,
    cacheKey);
com.android.volley.toolboxImageLoader

Javadoc

Helper that handles loading and caching images from remote URLs. The simple way to use this class is to call ImageLoader#get(String,ImageListener)and to pass in the default image listener provided by ImageLoader#getImageListener(ImageView,int,int). Note that all function calls to this class must be made from the main thead, and all responses will be delivered to the main thread as well.

Most used methods

  • get
    Issues a bitmap request with the given URL if that image is not available in the cache, and returns
  • <init>
    Constructs a new ImageLoader.
  • isCached
    Checks if the item is available in the cache.
  • batchResponse
    Starts the runnable for batched delivery of responses if it is not already started.
  • getCacheKey
    Creates a cache key for use with the L1 cache.
  • onGetImageError
    Handler for when an image failed to load.
  • throwIfNotOnMainThread
  • getImageListener
    The default implementation of ImageListener which handles basic functionality of showing a default i
  • makeImageRequest
  • onGetImageSuccess
    Handler for when an image was successfully loaded.
  • setBatchedResponseDelay
    Sets the amount of time to wait after the first response arrives before delivering all responses. Ba
  • setBatchedResponseDelay

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • requestLocationUpdates (LocationManager)
  • startActivity (Activity)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now