title: How to change the font color for custom buttons in an Android app?
body: <p>I am using a custom button class to use a custom font for all the buttons in my app. I would like to change the color too but I don't know how. It is probably pretty easy but I couldn't figure it out.</p>
  
  <p>Here is the code I use:</p>
  
  <pre><code>    public class CustomButton extends Button {
  
      public CustomButton(Context context, AttributeSet attrs, int defStyle) {
          super(context, attrs, defStyle);
          init();
      }
  
      public CustomButton(Context context, AttributeSet attrs) {
          super(context, attrs);
          init();
      }
  
      public CustomButton(Context context) {
          super(context);
          init();
      }
  
      private void init() {
          if (!isInEditMode()) {
              Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "MyCustomFont.otf");
              setTypeface(tf);
          }
      }
  }
  </code></pre>