I’ve seen numerous posts about Dates and comparing, but I’m looking for something in perticular.
Basically when this part of the app is opened I want it to save a date with shared preferences. (So preferably it is a long, string or something of the sort that can be saved). When 4 days have passed since it has been opened it should have a graphical change. (It no longer uses the graphic that it had the previous 4 days) and it will do this again 2 more times. So what is the best way to compare a saved date/time to the current to determine if 4 days have passed
Preferably I would like to use something like this in some form
if(savedDate < 4Days){
//One image will be displayed during these 4 days
}
else if(savedDate <= 8Days){
//Another images shows for these 4 days
}
It just needs to know whether that alotted amount of time has passed or not. I hope I didn’t make it too confusing. Any help is appreciated thanks.
Use System.currentTimeMillis
Save it in the shared preferances as long value and always compare it with a new measured currentTimeMillis until the difference would be > 4 * 24 * 60 * 60 * 1000