OiO.lk Blog Android Flickering black screen issue while loading image with Glide Android
Android

Flickering black screen issue while loading image with Glide Android


I am experiencing a flickering/black screen issue when using Glide to load images in my Android app.

There are scenario:

  • I load an image into an ImageView using Glide.
  • After the image is displayed, I’ve put some delay and then I remove the ImageView from the layout and create a new ImageView to load next image.
  • When loading the new image, the screen flickers briefly, showing a black screen before the new image is loaded.

This is the requirement to create new ImageView object while loading next image and this process will continue to infinite. like if I’ve 10 images then it will display after delay infinite time.

I’m using below configuration to load image with Glide

Glide.with(ivImage.context)
            .load(img)
            .dontAnimate()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(ivImage)

other then .dontAnimate() I’ve tried .dontTransform() but still it’s not working as expected.

What is the best way to prevent the flickering or black screen when loading images with Glide in this scenario?

Is there a specific configuration in Glide that I can use to avoid this issue?

You can check little black screen issue in attached video.



You need to sign in to view this answers

Exit mobile version