javaandroid-studiobuttontimervisibility

Set a timer for the visibility of a button


This is purely theoretical put let's say once I put a timer for a button to appear only 86400 second later (like 24h), will it the count down continue after the app is shut down ?

Can the user close the app and then come back the next day and find the button after the countdown is done ?

Or is there a better way to make it happen ? Like to allow the user to see it only after 24h ?


Solution

  • you can use ScheduledExecutorService to create such a timer. Then on every tick, you can open the app if you want, and show the button, or just show the button if the user open the app. documentation is available here.