It depends on your requirement. If you want to save something from text field or text area in a web application, onchange event you can call a javascript function and using ajax you can save that data on server. If you want to run something directly on server like some scheduled task you can use Timer class or bukkit-plugins. In android you can do something like this:
For this you can use the Timer -
final Handler handler = new Handler();
Timer timer = new Timer();
TimerTask doAsynchronousTask = new TimerTask() {
@Override
public void run() {
handler.post(new Runnable() {
@SuppressWarnings("unchecked")
public void run() {
try {
"Your function call "
}
catch (Exception e) {
// TODO Auto-generated catch block
}
}
});
}
};
timer.schedule(doAsynchronousTask, 0, "Timer value");
When your work is done, you can stop the timer by -
if(timer != null) {
timer.cancel();
timer = null;
}
For bukkit Plugins visit: https://dev.bukkit.org/bukkit-plugins/simple-autosave
4