Why does the isTheFinalCountDown method in Chronometer class open a YouTube video?

Viewed 754

The public method isTheFinalCountDown just opens a YouTube video for the song The Final Count Down.

All the doc has to say about it is this:

whether this is the final countdown

Since this is a public api, what would be a real world use-case for this method. Or is it just another easter egg like the isUserAGoat function?

2 Answers

To add some detail to the accepted answer, it uses Chronometer's Context to launch an Activity with an intent filter matching:

  • Action:Intent.ACTION_VIEW and a youtu.be uri
  • Category: Intent.CATEGORY_BROWSABLE presumably as a fallback if you don't have youtube installed

Here is the implementation ‍

/**
 * @return whether this is the final countdown
 */
public boolean isTheFinalCountDown() {
    try {
        getContext().startActivity(
                new Intent(Intent.ACTION_VIEW, Uri.parse("https://youtu.be/9jK-NcRmVcw"))
                        .addCategory(Intent.CATEGORY_BROWSABLE)
                        .addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT
                                | Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT));
        return true;
    } catch (Exception e) {
        return false;
    }
}
Related