// 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));
Button11.setBackgroundColor(0xFFFF0000); // 0xAARRGGBB
startBtn.getBackground().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP);
replace <Button with <androidx.appcompat.widget.AppCompatButton
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
change this to :
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">