Why does IDEA mark this Android code as erronous? It compiles
This is fine:
findViewById(R.id.cat_name).setVisibility(GONE);
This is not:
findViewById(R.id.cat_name).setVisibility(0x00000008);
What gives? Both are perfectly valid integers! If I wanted type checking, I'd use an enums (or rather - Google should have, but that's another discussion). Who is checking this? IDEA? Lint? Any way I can configure it to ignore these errors?
PS: If you wonder why I'd use inline constants instead of the defined constants: I don't. But using this method causes the same IDE-error:
public static int booleanToVisibleOrGone(boolean visible) {
return visible ? View.VISIBLE : View.GONE;
}
Please sign in to leave a comment.
It is checked by lint inspection "Constant and Resource Type Mismatches". Press Alt+Enter and you'll see it. There you're also able to suppress checking or even completely disable the inspection.
Ah, thanks, that fixed it :-)