How can I do this using Glide? I want to cache
image to use it another time also. Thanks in advance.
(SimpleTarget class is Deprecated So using CustomTarget class to Load image)
You can load an image in a RelativeLayout like this. I'm just showing you the hard part which is setting an image to the background.
For Glide version before 4.X (Without Deprecation)
Glide.with(this).load(ServiceGenerator.BASE_URL + url).into(new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
yourRelativeLayout.setBackground(resource);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});