Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;

import java.util.Random;

public class Main {
    private static String colors[] = { "#AAC3DE", "#B3CFC6", "#9592AA", "#A8DDC7", "#928087", "#E7F1FE", "#F7F3CE",
            "#A191AE" };
    private static Random random = new Random();

    public static ColorDrawable getRandomColor() {
        return new ColorDrawable(Color.parseColor(colors[random.nextInt(8)]));
    }
}