Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Android Powerful and optimized Image loader - Glide

    • 0
    • 3
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 465
    Comment on it

    Hi,
    Are you still working with Image Loader or Universal Loader library for lazy loading of images in listview. if yes then you should know that sometimes these libraries could give out of memory exception if you are fetching lots of images or images of large size. But now Google introduced us an Image Loader Library for Android development named Glide. It succeeded in making me interested. I spent a some hours playing with it and decided to post this blog. As a beginning, I found it similar to Picassa but it wasn't.

    It's bit simple to import in your Android studio by:
    dependencies { compile 'com.github.bumptech.glide:glide:3.5.2' compile 'com.android.support:support-v4:22.0.0' }

    So with Glide you don't have to copy lots of files like you did with Image loader or universal loader. You have to write a single line like this :

    Glide.with(context)
    .load("ImagePathHere")
    .into("ImageHere");
    

    Here you to pass the Activity or Fragment to Glide not just a Context if possible.

    Notes -

    1. You can change the format of your Image by setting GlideConfiguration class.
    2. You can resize the image by using override(300,300) property of Glide class.
    3. You can crop an image by using centerCrop() property.
    4. You can also set placeHolder and error image like.
     .placeholder(R.drawable.placeholder)
    .error(R.drawable.imagenotfound)
    
    1. The another intersting feature is to provide Gif image decoding for Animations.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: