calculate the color of the image for a new session - Android Graphics

Android examples for Graphics:Color Operation

Description

calculate the color of the image for a new session

Demo Code


//package com.java2s;
import java.util.Random;

public class Main {
    private final static int MAX_VAL = 0xFF;

    public static int imageColorSelector() {
        int color = 0;

        Random random = new Random();

        int aa = MAX_VAL << 24;
        int rr = ((int) ((random.nextDouble() * 256))) << 16;
        int gg = ((int) ((random.nextDouble() * 256))) << 8;
        int bb = ((int) ((random.nextDouble() * 256)));

        color = (((aa | rr) | gg) | bb);

        return color;
    }//from w  w  w .j a va2s. c  om
}

Related Tutorials