Android’s Inside Joke
I was looking into Android’s Chronometer for an app I’m developing, and I discovered the ultimate feature.
It’s not the first time I’ve used Chronometers, and each time I notice the isCountdown() method, described as “whether this view counts down” and the cryptic isTheFinalCountdown() method, which I assumed was a joke on Europe’s “The Final Countdown” and no more.
However, I got curious and I’m using a chronometer anyway, so I actually called the isTheFinalCountdown() function on my Chronometer, and…
My innocent app opened YouTube and started playing the official version of Europe’s song!
So now you too can create an app to open “The Final Countdown”… using a Chronometer.
Create an Empty Project in Android Studio
File → New → New Project:
Select Empty Activity and press Next.
Choose a name and location for your project and press Finish.
Open activity_main.xml. Copy the following code into it (or add a Chronometer and a Button and arrange it any way you like)
I used a ConstraintLayout, added a Chronometer and a Button, and created a vertical chain from the two. I added an onclick function called finalCountdown to the Button. And I increased the text size of the Chronometer, just because I felt like it.
And now for the Activity:
We start our chronometer in onCreate (though we don’t really have to). And if we click our Final Countdown button, we call isTheFinalCountdown on our Chronometer.
And the result:
Check it out!