Android ImageView replacement which allows image loading from URLs or contact address book, with caching

Last update: May 10, 2022

Smart Image View for Android

SmartImageView is a drop-in replacement for Android’s standard ImageView which additionally allows images to be loaded from URLs or the user’s contact address book. Images are cached to memory and to disk for super fast loading.

Features

  • Drop-in replacement for ImageView
  • Load images from a URL
  • Load images from the phone’s contact address book
  • Asynchronous loading of images, loading happens outside the UI thread
  • Images are cached to memory and to disk for super fast loading
  • SmartImage class is easily extendable to load from other sources

Documentation, Features and Examples

Full details and documentation can be found on the project page here:

http://loopj.com/android-smart-image-view/

GitHub

https://github.com/loopj/android-smart-image-view
Comments
  • 1. Bitmaps are extremely low quality

    Since commit 302339fce748f6ad83163f520a0b26cf35c5bb35 all my Bitmaps (JPG and PNG) are extremely low quality and pixelated. I load the images from a webserver and have tested it with different images, servers and different locations in my App.

    Seems that the new Bitmap decoding routing is not working for me.

    Reviewed by mac-cain13 at 2013-02-19 11:17
  • 2. Added support to get handle of bitmap on image load complete

    Hi @loopj

    I have added support in OnCompleteListener to get reference(handle) of bitmap with onComplete(Bitmap). Also taken care of backward compatibility of old api call onComplete().

    I think having a way to get referece of bitmap will be handy for other applications.

    Reviewed by rutvijkumarshah at 2014-06-16 18:29
  • 3. Added OnCompleteListener

    Added OnCompleteListener to support external callbacks. My use case was that I had a shadow below my ImageView, however if the loading of the image took too much time, the shadow was just laying there. By setting a callback I can show the shadow only after the image loaded completely.

    Reviewed by ffleandro at 2012-11-19 15:01
  • 4. Scaling of images

    Is there a way to scale the images, to make it similar to:

    ImageView image;
    image = (ImageView)findViewById(R.id.yourImageView1);
    image.setScaleType(ImageView.ScaleType.FIT_CENTER);
    

    There is no provision that is similar. I would like to scale images across many android devices. Is this the right approach?

    /* some code not shown; smartImageView is basically an instance of SmartImageView */
    smartImageView.setImageUrl(data.picture);
    smartImageView.setMaxHeight(10);
    smartImageView.setMaxWidth(10);
    

    What units are used as parameters for setMaxHeight() and setMaxWidth() or other methods for size setting?

    Thanks.

    Reviewed by miclovich at 2013-06-16 09:23
  • 5. While scrolling images in list view is disturbed.

    To explain with an example.

    List View

    Image 1 Image 2 Image 3 ------- Beyond the visible area ----- Image 4 Image 5

    All the image tags have default src attribute for empty images.

    Now when I scroll down & if the connection is slow by default I will see Image1 and Image 2 in Image 4 and 5 place holders. Once the image is loaded it replaced it with correct images.

    This is more visible when we scroll fast or use bigger images. It would be great if Image 4 and Image 5 could show the default drawable if the image is not loaded while scrolling.

    We tried to play around with the code but I am no expert to fix it :)

    EDIT : Fixed by assigning default drawable for this view

    Reviewed by BuddhaSource at 2012-06-08 03:31
  • 6. Crash Aplicattion

    .XML <com.loopj.android.image.SmartImageView android:id="@+id/my_image" android:layout_height="match_parent" android:layout_width="match_parent" />

    .JAVA SmartImageView myImage = (SmartImageView) findViewById(R.id.my_image); myImage.setImageUrl("http://www.awesomeimages.com/myawesomeimage.jpg");

    Manifiest

    error FATAL EXCEPTION: main Process:, PID: 14393 java.lang.NullPointerException: Attempt to invoke virtual method 'void com.loopj.android.image.SmartImageView.setImageUrl(java.lang.String)' on a null object reference

    Reviewed by diegoarielbarriosmichalik at 2016-10-15 01:56
  • 7. Still supported

    Is smart image view still being updated/supported. It appears that is has not been updated in years and looking to see if it would handle images and mp4 and AndroidStudio.

    Reviewed by justdan0227 at 2016-06-21 12:36
  • 8. Cache removal control

    need to have cache removal control. This can be done if the WebImageCache would be private and providing a getInstance method to the file would make this happen.

    Reviewed by naveenthontepu at 2016-06-03 05:25
  • 9. Overloaded the method setImageUrl to receive an URLConnection as parameter

    I changed the WebImage class and the SmartImageView class to receive an URLConnection as parameter, in case of need is can pass a cookie to URLConnection in request, for example , the secure cookie Amazon CloudFront

    Reviewed by fabriciopaulo at 2015-10-21 17:43
Replacement for deprecated official Android crop image function

The MIT License (MIT) Copyright (c) 2012 Jan Muller Permission is hereby granted, free of charge, to any person obtaining a copy of this software and

Apr 12, 2022
Custom ImageView for moving image around the screen (Android)
Custom ImageView for moving image around the screen (Android)

MovingImageView Create a custom ImageView for moving image around the screen. Usage To use MovingImageView, add the module into your project and start

Mar 15, 2022
Flickable ImageView for Android. It's like a view of twitter's detail image.
Flickable ImageView for Android. It's like a view of twitter's detail image.

FlickableView Flickable ImageView for Android. It's like a view of twitter's detail image. It's possible that other views animate with FlickableView.

Sep 13, 2021
A library for Android provides blurred drop shadows to ImageView similar to iOS image backdrop shadows
A library for Android provides blurred drop shadows to ImageView similar to iOS image backdrop shadows

A library for Android provides blurred drop shadows to ImageView similar to iOS image backdrop shadows.Provides fast canvas draw as no renderscript needed .The similar shadow blurred effects can also be seen in iOS Music App.

May 17, 2022
Custom ImageView to generate captcha image.
Custom ImageView to generate captcha image.

CaptchaImageView Custom ImageView to generate captcha image. Add CaptchaImageView to your layout <test.jinesh.captchaimageviewlib.CaptchaImageView

May 6, 2022
AndroidGradientImageView is a simple imageview which overlays gradient on its content.
AndroidGradientImageView is a simple imageview which overlays gradient on its content.

AndroidGradientImageView AndroidGradientImageView is a simple imageView which overlays gradient on its content like below: Setup Gradle dependencies {

Apr 24, 2022
Image Picker with Customizable UI for Android, Pick an image from Gallery
Image Picker with Customizable UI for Android, Pick an image from Gallery

Image Picker A Image Picker Library for Android (Supports Android 12) with fully

Dec 20, 2021
Custom ImageView for android with polygon shape (Android)
Custom ImageView for android with polygon shape (Android)

PolygonImageView Create a custom ImageView with polygonal forms. Usage To use PolygonImageView, add the module into your project and start to build xm

Mar 15, 2022
Implementation of ImageView for Android that supports zooming, by various touch gestures.
Implementation of ImageView for Android that supports zooming, by various touch gestures.

PhotoView PhotoView aims to help produce an easily usable implementation of a zooming Android ImageView. [ Dependency Add this in your root build.grad

May 22, 2022
A circular ImageView for Android
A circular ImageView for Android

CircleImageView A fast circular ImageView perfect for profile images. This is based on RoundedImageView from Vince Mi which itself is based on techniq

Mar 29, 2021
Adds touch functionality to Android ImageView.

TouchImageView for Android Capabilities TouchImageView extends ImageView and supports all of ImageView’s functionality. In addition, TouchImageView ad

Mar 28, 2021
Custom shaped android imageview components
Custom shaped android imageview components

Shape Image View Provides a set of custom shaped android imageview components, and a framework to define more shapes. Implements both shader and bitma

Mar 29, 2021
Android ImageView widget with zoom and pan capabilities

ImageViewTouch for Android ImageViewTouch is an android ImageView widget with zoom and pan capabilities. This is an implementation of the ImageView wi

May 15, 2022
Implements pinch-zoom, rotate, pan as an ImageView for Android 2.1+

GestureImageView This is a simple Android View class which provides basic pinch and zoom capability for images. Can be used as a replacement for a sta

Apr 15, 2022
Android ImageView that handles animated GIF images
Android ImageView that handles animated GIF images

GifImageView Android ImageView that handles Animated GIF images Usage In your build.gradle file: dependencies { compile 'com.felipecsl:gifimageview:

Mar 9, 2021
Android ImageView that supports different radii on each corner.
Android ImageView that supports different radii on each corner.

SelectableRoundedImageView Note that this project is no longer maintained. Android ImageView that supports different radii on each corner. It also sup

Mar 17, 2021
ImageView with a tag on android
ImageView with a tag on android

SimpleTagImageView ImageView with a tag in android. So it's a ImageView. Demo ####Warning:When you set the round radius,the simpletagimageview scale t

Apr 27, 2022
Create parallax and any other transformation effects on scrolling android ImageView
Create parallax and any other transformation effects on scrolling android ImageView

Android Parallax Image View Creates effect such as vertical parallax, horizontal parallax etc. on android ImageView when it's being vertically or hori

Mar 9, 2022
Implementation of ImageView for Android that supports zooming, by various touch gestures.
Implementation of ImageView for Android that supports zooming, by various touch gestures.

PhotoView PhotoView aims to help produce an easily usable implementation of a zooming Android ImageView. [ Dependency Add this in your root build.grad

May 23, 2022