[英]Returning to Activity after a specified period of time
I would like to return to specified Activity
from each other Activity
after specified period of idle time. 我想在指定的空闲时间后从其他
Activity
返回指定的Activity
。 What should I use: Service
, AlarmManager
or maybe something else? 我应该使用什么:
Service
, AlarmManager
或其他什么?
If you just want this to work only for your activities (not from background etc.) just use TimerTask in every activity of yours (well, in a superclass to avoid duplication). 如果你只是想让它只适用于你的活动(不是来自后台等),那么只需在你的每个活动中使用TimerTask (好吧,在超类中避免重复)。 There's no point in putting up a Service for that.
为此提供服务毫无意义。
使用Pending Intent,请参阅此链接... http://developer.android.com/reference/android/app/PendingIntent.html
Instead of using a service, or alarmmanager, you can use timertask, or i would suggest handler. 您可以使用timertask,或者我建议处理程序,而不是使用服务或警报管理器。 Handler.postdelayed.
Handler.postdelayed。 Its a better option.
这是一个更好的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.