The method startTaskForPeriodicallyUpdatingRelativeTime() is called both in onAttachedToWindow() and in onVisibilityChanged(). This could result in the Runnable being scheduled twice.
This is because the first time the RelativeTimeTextView is added to its parent, both onAttachedToWindow() and onVisibilityChanged() are called (the latter is called for the parent Window).