Reputation: 191
I have three activities 1 is the main activity 2 is some other activity that does something and 3 is some other activity that does some storage management with sqlite
in this 3 activity I have a function that updates some data on the database's table
I want every 10 seconds to call a function in order to update this table
ScheduledExecutorService can do what I want. However I'm not 100% sure. If I'm on the 1 activity will it be able to call the function from the 3 activity even though I'm on the 1?
I also found alarmmanager but I don't want the update of information to be happening even when I close my application, I want it to happen only when I have the application open!
thanks!
Upvotes: 0
Views: 290
Reputation: 14700
You can use TimerTask
or Handler
. Here is a tutorial:
http://developer.android.com/resources/articles/timed-ui-updates.html
Upvotes: 2