Question: I want to display 60 different colors in 1 second in android. How I can do this that the duration of display(16ms) of all colors is same during 1 second?

Answer: 
What you need can be achieved in a custom `View` where you call `invalidate()` on each `onDraw()` invocation:

```
int framesToRedraw = 0;

public void startAnimation(int frames){
     framesToRedraw = frames;
     this.invalidate();
}

/**
 * onDraw override.
 * If animation is "on", view is invalidated after each redraw
 * to make android redraw it on the next frame
 */
@Override
public void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (framesToRedraw > 0) {
         // generate new color randomly
         float[] hsvColor = {0, 1, 1};
         hsvColor[0] = random.nextFloat() * 360f;
         this.setBackgroundColor(Color.HSVToColor(hsvColor));
         framesToRedraw--;
         this.invalidate();  // force the view to be redrawn on each frame
    } 
}

```
You can use the `Handler` class to manage delayed executions. [Here](https://stackoverflow.com/questions/13100196/making-a-interval-timer-in-java-android) you have an example on how to use it to generate a timer every n millis.

```
final Handler handler = new Handler();
handler.postDelayed(new Runnable(){
    private static final long INTERVAL = 16L;
    private long time = 0;

    @Override
    public void run(){
        time += INTERVAL;
        if(time <= 1000){
            handler.postDelayed(this, INTERVAL); //Make sure you are calling it after 16 millis
        }
        // Change your color here
        changeColor();
    }
}, INTERVAL);

```