简体   繁体   中英

Question about Threads and Timer object at an interval time

I just need to refresh a ListView with a Feed, which you recommend me for this? A thread? A timer object? I was thinking use a Timer Object with an interval time.

But i am thinking at the moment when a user leave the activity and maybe the timer could not be stopped.

what do you think?

I would suggest using a ScheduledExecutorService: ScheduledExecutorService

The link I have provided has a code example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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