I saw all the post in here and still I can\'t figure how do get difference between two android dates.
This is what I do:
long diff = date1.getTime()
written in Kotlin: if you need difference between 2 dates and don't care about the dates itself ( good if you need to do something in the app,based on time from other operation time that was saved in shared preferences for example). save first time :
val firstTime:Long= System.currentTimeMillis()
save second time:
val now:Long= System.currentTimeMillis()
calculate the miliseconds between 2 times:
val milisecondsSinceLastTime: Long =(now-lastScrollTime)