Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

generate random color in java in android

@RequiresApi(api = Build.VERSION_CODES.O)
private int generateRandomColor() {
    Random rand = new Random();
    float r = rand.nextFloat();
    float g = rand.nextFloat();
    float b = rand.nextFloat();
    return Color.rgb(r, g, b);
}
 
PREVIOUS NEXT
Tagged: #generate #random #color #java #android
ADD COMMENT
Topic
Name
8+5 =