title: How to set random colors and button rounded at the same time?
body: <p>I'm trying to make buttons rounded, random background color? When I tried the code below, the button isn't rounded.</p>
  
  <p>Here is the code: </p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.newtestament);
      LinearLayout layout = (LinearLayout) findViewById(R.id.linearlayoutnew);
      String[] values = { "Matthai", "Marka", "Luka", "Johan",
              "Sawltak Tangthu", "Rom Laikhak", "Korin Masa", "Korin Nihna",
              "Galati", "Efesa", "Filippi", "Kolose", "Thesalonika Masa",
              "Thesalonika Nihna", "Timoti Masa", "Timoti Nihna", "Titus",
              "Filemon", "Hebru", "James", "Peter Masa", "Peter Nihna",
              "Johan Masa", "Johan Nihna", "Johan Thumna", "Jude",
              "Maangmuhna" };
      Button[] b = new Button[values.length];
      for (int i = 0; i &lt; b.length; i++) {
          b[i] = new Button(this);
      }
      int[] btnColor = { 0xAAe60038, 0xAA9142d6, 0xAAf07b04, 0xAA1515ff,
              0xAA23699e, 0xAA0a71ff, 0xAA3e3d39, 0xAA00b323, 0xAA754e45,
              0xAAfa061e, 0xAAe66d2d, 0xAAff00ff };
      // calling random
      Random random = new Random();
      // ramdomizing a color
      int c = btnColor[random.nextInt(btnColor.length)];
      for (int i = 0; i &lt; values.length; i++) {
  
          // applying button rounded xml style
          b[i].setBackgroundDrawable(getResources().getDrawable(
                  R.drawable.round));
          // setting randomized color
          b[i].setBackgroundColor(c);
          // layout
          LayoutParams params = new LinearLayout.LayoutParams(
                  LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
          // margin
          ((MarginLayoutParams) params).setMargins(5, 5, 5, 5);
          // padding
          b[i].setPadding(10, 10, 10, 10);
          // text color
          b[i].setTextColor(0xFFFFFFFF);
          // text
          b[i].setText(values[i]);
          // text size
          b[i].setTextSize(18);
          Typeface face = Typeface.createFromAsset(getBaseContext()
                  .getAssets(), "UBUNTU-R.TTF");
          b[i].setTypeface(face);
          layout.addView(b[i], params);
  
      }
  
  }
  </code></pre>
  
  <p>Here is round.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="rectangle" &gt;
  
  &lt;!-- you can use any color you want I used here gray color --&gt;
  &lt;corners
      android:bottomLeftRadius="5dp"
      android:bottomRightRadius="5dp"
      android:topLeftRadius="5dp"
      android:topRightRadius="5dp" /&gt;
      &lt;/shape&gt;
  </code></pre>
  
  <p>I think  the problems are setBackgroundDrawable, setBackgroundColor and romdomizing. What additional codes are needed? ??? <br> <strong>Update</strong>:How to edit round.xml to make the button rounded?</p>