cant change button color when app run android studio code example
Example 1: android studio change button color programmatically
// If you're in an activity:
Button11.setBackgroundColor(getResources().getColor(R.color.red));
// OR, if you're not:
Button11.setBackgroundColor(Button11.getContext().getResources().getColor(R.color.red));
Example 2: android studio change button color programmatically
Button11.setBackgroundColor(0xFFFF0000); // 0xAARRGGBB
Example 3: cant change button color when app run android studio
replace <Button with <androidx.appcompat.widget.AppCompatButton