简体   繁体   English

设置按钮可见性的计时器

[英]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 84600 second later (like 24h), will it the count down continue after the app is shut down ? 这纯粹是理论上的假设,假设我为按钮设置了计时器,使其仅在84600秒后(如24h)出现,那么在关闭该应用程序后,计时是否会继续?

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 ? 想要让用户仅在24小时后看到它?

you can use ScheduledExecutorService to create such a timer. 您可以使用ScheduledExecutorService创建此类计时器。 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 . 文档可在此处获得

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM