Returns a random color. - Android Graphics

Android examples for Graphics:Random Color

Description

Returns a random color.

Demo Code


//package com.java2s;
import android.graphics.Color;
import java.util.Random;

public class Main {
    private static Random randomGenerator = new Random();

    /**/*from  ww w. ja v  a2s  .co m*/
     * Returns a random color.
     * @return
     */
    public static int getRandomColor() {
        return Color.rgb(randomGenerator.nextInt(255),
                randomGenerator.nextInt(255), randomGenerator.nextInt(255));
    }
}

Related Tutorials