Return random Color - Android android.graphics

Android examples for android.graphics:Color

Description

Return random Color

Demo Code

import android.graphics.Color;

public class Main {

  public static int randomColor() {
    return Color.argb(127, ((Long) Math.round(Math.random() * 255)).intValue(),
        ((Long) Math.round(Math.random() * 255)).intValue(), ((Long) Math.round(Math.random() * 255)).intValue());
  }//from   w w w  . j  a va 2s  .  c  o  m

}

Related Tutorials