-2

In my android Apps I have used Chronometer,it works good.Now I want to view chronometer time in different color ie when chronometer is started it glow BLACK color and after 30 minutes it glow RED. How It is Possible?

Chandan
  • 1
  • 2

1 Answers1

0

Chronometer is just a view which can be set to any color at any point of time.

chronometer.setBackgroundColor(color);

Refer Chronometer

For different time interval you need to implement a OnChronometerTickListener on your chronometer. Here is an example:

chronometer.setOnChronometerTickListener(new OnChronometerTickListener() {
@Override
public void onChronometerTick(Chronometer chronometer) {
      long elapsedTime = SystemClock.elapsedRealtime()
                        - chronometer.getBase();
}
});
Daud Arfin
  • 2,499
  • 1
  • 18
  • 37
  • when we use this above it's change the background color but where to define time interval. Thanks. – Chandan Dec 18 '15 at 07:05