question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use placeholderRes/errorRes if url is null

See original GitHub issue

It would be cool if passing null url would use placeholder drawable or error drawable if set. Right now it defeats the purpose of fluent api when you have to do something like:

if (imageUrl != null) { it.load(imageUrl) { placeholder(placeholderRes) } } else { it.setImageResource(placeholderRes) }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
colinrtwhitecommented, Oct 10, 2019

@mlilienberg Great point. I think it makes sense to use the same API as Glide. i.e.:

imageView.load(itemModel.imageUrl) {
   placeholder(R.drawable.ic_placeholder)
   error(R.drawable.ic_error)
   fallback(R.drawable.ic_error)
}

Similar to placeholder and error, you should be able to set the default fallback on your ImageLoader.

3reactions
colinrtwhitecommented, Nov 23, 2019

This is now supported in master. To get the fix asap you can depend on 0.9.0-SNAPSHOT.

NOTE: There might be minor behaviour changes to the feature before 0.9.0 stable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using placeholder in Coil when the url is null - Stack Overflow
I get some data from database and push it to reciclerview. I use Coil to show images. But there are some urls that...
Read more >
Placeholders - Glide v4 - GitHub Pages
If the request fails and an error Drawable is not set, the placeholder will continue to be displayed. Similarly if the requested url/model...
Read more >
<input type="url"> - HTML: HyperText Markup Language | MDN
A placeholder is a value that demonstrates the form the value should take by presenting an example of a valid value, which is...
Read more >
Broken Image for plugin Placeholder | Confluence Server and ...
Confluence generates a lot of Broken Image for plugin Placeholder error. ... IllegalArgumentException: input == null! at java.desktop/javax.imageio.
Read more >
NullReferenceException for placeholders in Experience Editor
So, as per the error info you've shared, in your case the Null ... Inner Exception: Object reference not set to an instance...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found