I have a broadcast receiver that receives event when user manually changes Date . But I am unable to find what was the previous date he changed. Example- If date was 5-June-2014 and he changed it to 01-June-2014. I want to know the previous date that is 5-june-2014. Please help
Asked
Active
Viewed 4,290 times
1
-
android.intent.action.DATE_CHANGED is the intent for date changed. – ngrashia Jun 10 '14 at 06:45
-
For that you would have to keep running a service every minute or so and updating the time to a value in the sharedpreference. – ngrashia Jun 10 '14 at 06:50
-
thanks for reply, but i want to know the previous date that user has changed, is there any property or method that i can use in Broadcast receiver that tells what was the date that user changed ? – amit kumar Jun 10 '14 at 07:01
-
You would have to keep saving the time value every minute and when the broadcast reciever, sends you signal of time changed, then in your handler action, you would have to get the last saved time in sharedpreference and do necessary action with it. Hope you can understand what i am trying to communicate. – ngrashia Jun 10 '14 at 09:01
-
I've made a full sample of this exactly, including telling you what was the previous date it was on, here: https://stackoverflow.com/a/48782963/878126 – android developer May 30 '18 at 14:43
1 Answers
0
You could register ACTION_TIME_TICK
and record the current date every minute.

Nicolas Defranoux
- 2,646
- 1
- 10
- 13