Jacob Collins Jacob Collins - 1 year ago 94
Android Question

Why won't Glide load an image from resource ID to my ImageView?

I've got all of the images I need for my app, and I'm trying to speed it up and make it silky smooth, so I have been using Glide to load the images and it works in other areas of my app but not in my viewpager.

In my fragment I'm trying to load my image like so


and nothing happens or appears and I don't get an exception or any sort of error message from Glide.

Answer Source

Check out the Debugging and Error Handling wiki page to enable logging. That should tell you if the load is failing and why.

If you see no error logs, it's possible that your View doesn't have a size, either because its size is 0, or because it hasn't gone through layout (visibility set to View.GONE etc). If so, you can test check by adding a call to override() with any valid width and height (try 400, 400 or something just to test).

If calling override() fixes the issue, take a look at your xml and see if you can change your view to either have a fixed size, or to at least eventually end up with a valid size. If all else fails, you can always call override() with Target.SIZE_ORIGINAL as the width and height.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download