Load Image in android with Glide library

Add Dependency to your App level gradle file
implementation 'com.github.bumptech.glide:glide:3.7.0'

After Adding dependency for glide library click on "sync"
after sync completed Add below imageview code to your xml
layout file.

1
2
3
4
5
6
7
8
9
                <ImageView
                    android:id="@+id/profile_img"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:src="@drawable/avatar"
                    android:padding="2dp"
                    android:scaleType="centerCrop"
                    android:adjustViewBounds="true"
                    />

Now Add below Glide code into your activity.java file.


1
2
3
        Glide.with(this)
                .load(session.getPhotoUrl())
                .into(profile_img);

Happy Coding!

Thanks.


Comments