
Glide Image Library in Android
Glide Library is a fast and efficient image loading library for Android focused on smooth scrolling. It is supports fetching, decoding, and displaying images, and animated GIFs. It is includes a flexible api that allows developers to plug in to almost any network stack.
Glide Library is a Open Source Image loading and caching library in android app. In this Library wraps memory and disk caching, resource pooling and media decoding into a simple and easy to use interface.
It is Image Decoding support and Smooth rending of images without stuttering Performance.
In this Library you can download image from server into you app and display images.it is fast downloading images from server and display. you can multiple image download in this library and it does not loading more time.
You can use this library and implement app level gradle.build file
1 2 |
implementation 'com.github.bumptech.glide:glide:4.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' |
You can Declare repository in project level gradle.build file
1 2 3 4 |
repositories { mavenCentral() google() } |
You can Define Internet Permission in AndroidManifest.xml File
1 |
<uses-permission android:name="android.permission.INTERNET" /> |
Example of Glide Image Library in Android
Create activity_main.xml file Follow this code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.bhaumik.MainActivity"> <ImageView android:id="@+id/image_view" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> |
Create MainActivity.java File Follow this code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
package com.example.bhaumik; import android.app.ProgressDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ImageView; import com.bumptech.glide.Glide; public class MainActivity extends AppCompatActivity { ImageView imageView; String url = "https://static.pexels.com/photos/53966/rabbit-palm-hand-snatch-53966.jpeg"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView = (ImageView) findViewById(R.id.image_view); Glide.with(MainActivity.this).load(url).into(imageView); } } |
I have Create Simple Example of Glide Image Library. In this Example of use Glide library implement and simple imageView and declared single image URL to download image using glide.
Define Glide library and declared string url in load() method parameter. and display ImageView to Define into() method to pass imageView. now it will download image from url and set the image of ImageView and display image.