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).
The method
startTaskForPeriodicallyUpdatingRelativeTime()is called both inonAttachedToWindow()and inonVisibilityChanged(). This could result in theRunnablebeing scheduled twice.This is because the first time the
RelativeTimeTextViewis added to its parent, bothonAttachedToWindow()andonVisibilityChanged()are called (the latter is called for the parent Window).