int color = (colorString != null) ?
someIntReturningMethod(colorString) :
ContextCompat.getColor(c, R.color.defaultForWhatever);
notificationBuilder.setColor(color);
I get "Should pass resolved color instead of resource id here".
If I remove the ?: and leave color defined as either one, Lint has no problems.
Can I fix this without suppressing any useful warnings? If not, which one do I suppress?
Please no ad-hoc solutions for this problem specifically. I'm asking about ?: confusing lint.
[edit] So, no solution for "?: confusing Lint", in general?
You can use @ColorInt annotation to annotate that method so lint wont throw a warning
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With