I was wondering if its possible to change the buttons background in a for loop
This is the code i have tried:
for(int i=0;i<=value;i++) {
Button button = (Button) view.findViewById(R.id.button + i);
button.setBackground(getResources().getDrawable(R.drawable.ic_favorite_border_black_24dp, null));
}
Where value = an integer between 0 and 10.
Error i get is a nullpointer exception. Please help me.