Solution 1 :
Use the transition
effect to load the image smoothly and fast.
GlideApp
.with(context)
.load(url)
.transition(DrawableTransitionOptions.withCrossFade()) //for loading image smoothly and fastly.
.placeholder(placeHolderUrl)
.error(errorImageUrl)
.fitCenter()
.into(imageView);
want more animation and smooth loading of images. See here
https://bumptech.github.io/glide/doc/transitions.html
Let me know if you have any problem
Problem :
I want to lazy load image inside my cardview but it’s not working below is my code but i am confused how to lazy load image using glide
int width = metrics.widthPixels;
int height = metrics.heightPixels;
BitmapRequestBuilder builder =
Glide.with(context)
.load(Constants.IMAGE_DOWNLOAD + pathName)
.asBitmap();
FutureTarget futureTarget = builder.into(width, height);
return (Bitmap) futureTarget.get();
}
private Bitmap loadImageForNoti(Context context, String pathName) throws ExecutionException, InterruptedException {
DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
int width = metrics.widthPixels;
int height = metrics.heightPixels;
BitmapRequestBuilder builder =
Glide.with(context)
.load(pathName)
.asBitmap();
FutureTarget futureTarget = builder.into(width, height);
return (Bitmap) futureTarget.get();
}```
[This is my [code][1] 1 ][1]
[This is my [second][2] code ][2]
i am confused where to add code to lazy load image using glide
[1]: https://i.stack.imgur.com/851dp.png
[2]: https://i.stack.imgur.com/CHnJQ.png
Comments
Comment posted by How to lazy load images in ListView in Android
Does this answer your question?
Comment posted by suraj gaikwad
Basically the problem is that when i am opening the app and click on any image then related to that images are showing below in cardview but when i am using mobile data it’s loading only half images of cardview and other images are not loaded so how to load remaining images in above code.
Comment posted by M DEV
@surajgaikwad you have to mention this problem in your question and also want to share images and code of that issue. Please mention this issue and code in your question.