U
U
USBHawk2018-10-02 19:22:43
Android
USBHawk, 2018-10-02 19:22:43

How to reset the counter at the beginning of a new month?

The question is, how to implement resetting the counter when a new month arrives? It must be implemented in the application.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor, 2018-10-02
@USBHawk

remember the number of the current month for example in SharedPreferences
Create a BroadcastReceiver that reacts to the date change event (android.intent.action.DATE_CHANGED)
When reacting to a date change, check if a new month has come. If it has come - resetting the counter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question