blitz is a very lightweight Android library that allows you to set a self-updating string with relative time in TextView in just one line of code.


DOESN'T require using custom TextView.

It will not overheadly update your TextView: e.g. if your relative time is 5 minutes ago then blitz will send update only after one minute, not every second. The same with others time units: hours updates once an hour, etc.

Don't be scared to use it in your ViewHolders, 'cause blitz won't let anything leak and will take care of the system resources.

Briefly usage:

val myTextView: TextView = ...
val eventTime: Long = ...

// just one line of code and that is it!

Languages support:

  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡·πŸ‡Ί Russian

There's not your language? You can help the community by sending a Pull Request.


Step 1

Add repository to your file (project)

allprojects {
  repositories {
    maven { url '' }

Step 2

Add dependency to your file (app) or other module

dependencies {
   implemetation 'com.github.perfomer:blitz:LATEST_VERSION'

See the lastest release version here: .



If you want to set the self-updating string with relative time direct into the TextView then use extesnsion method:


You can also customize it a bit:

  // Can be Long or java.util.Date
  time = eventTime,
  // If [true]: Show the exact seconds count if time difference is less than minute 
  // Or if [false]: Show "just now" message in that case.
  showSeconds = true, 
  // Don't want auto-update? Just set it to false.
  autoUpdate = false 

If you don't want to get time updates more than use cancel method:



If you just want to get a time-relative string, then you can use the following extension methods:

val contextString: String = context.getTimeAgo(time = eventTime, showSeconds = false)
val resourcesString: String = resources.getTimeAgo(time = eventTime, showSeconds = false)