Question Detail

How to set an image to an ImageView from a URL Android?

6 years ago Views 1929 Visit Post Reply

I am using ImageView for display ProfileImage but User's Image Comming from URL. Is there any way to load Image from URL Very fast? How can I load Image from URL in ImageView? 


Thread Reply

Hemant Sharma

- 6 years ago

Glide is a quick and productive open source media administration and picture stacking structure for Android that wraps media deciphering, memory and circle storing, and asset pooling into a straightforward and simple to utilize interface.

  • provides animated GIF support
  • handles image loading/caching
  • resize the image before displaying
  • Glide automatically limits the size of the image
  • it holds in memory to the ImageView dimensions
  • It care must be taken to resize and/or scale the image appropriately
  • Picasso has the same ability but requires a call to fit().
    You can download a jar from GitHub's releases page.
    
    Or use Gradle:
    
    repositories {
      mavenCentral()
      maven { url 'https://maven.google.com' }
    }
    
    dependencies {
      compile 'com.github.bumptech.glide:glide:3.7.0'
    }
    
    There is some error with new Version of Glide : 4.2.0 (NOT WORKING)
    ---------------------------------------------------------
    
    Glide.with(context)
        .load("http://qna.vbagetech.com/assets/images/logo.png")
        .override(100, 200) 
        .fitCenter() // scale to fit entire image within ImageView
        .into(ivImg);



    For Adding Extra Effects Use Below Dependancy
    compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'
    
    compile 'jp.wasabeef:glide-transformations:2.0.2'
    Effects

    Blur:

    Glide.with(this)
            .load("http://qna.vbagetech.com/assets/images/logo.png")
            .bitmapTransform(new BlurTransformation(context))
            .into(ivImg);


    Multiple transforms:

    Glide.with(this)
            .load("http://qna.vbagetech.com/assets/images/logo.png")
            .bitmapTransform(new BlurTransformation(context, 25), new CropCircleTransformation(context))
            .into(ivImg);