AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



java-ajax: How to do autosave in java?

Could you plz explain "autosave" concept in java with sample code.




Thanking you.

java x 210
ajax x 7
Posted On : 2016-09-29 06:51:55.0
profile MOHAMMAD SALEEM BASHA - anyforum.in MOHAMMAD SALEEM BASHA
266150
up-rate
5
down-rate

Answers


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


Posted On : 2016-09-29 23:46:48
Satisfied : 1 Yes  0 No
profile Rishi Kumar - anyforum.in Rishi Kumar
523187021414
Reply This Thread
up-rate
4
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in