I created a button programmatically and give it a ID and a Tag.
Button button = new Button(this);
button.setId(i);
button.setTag(anotherID);
i is a counter.
Now i want to change the background of this button, but i can't find it with
findViewByID(ID)
or
findViewWithTag(anotherID)
I use for ID and anotherID the values that i created the buttons with, but i only get NullPointerExceptions. I get no ids from a XML file, because i create the buttons programmatically. Did anybody know how i can handle this?