Reputation: 14435
I'm trying to create a RelativeLayout
with several children programmatically. To make the rules like RelativeLayout.RIGHT_OF
work, the child views must have proper IDs.
However, when I try to assign an ID, Android Studio flags it as an error:
view.setId(123);
ERROR: Expected resource of type id
Upvotes: 7
Views: 11598
Reputation: 4012
You have two options:
Upvotes: 4
Reputation: 4857
In Android Studio click on lightbulb on line with this 'error'. And select 'Disable inspection' in first submenu.
Upvotes: 0
Reputation: 11
As others have said, you shouldn't be using Integers directly in this case. There are some very rare cases where you might need to do this or in general suppress validation warnings. If so then you need to look into Lint. In Android Studio you can click on the red light bulb at the left side of the line of code. This will show a context menu with a list of methods of suppression.
Upvotes: -1