java - Schedule the same task for different time interval -


is possible schedule 1 task different time intervals? here fixed interval example:

timer gtimer = new timer();  calendar startdate = calendar.getinstance();    startdate.set(calendar.hour_of_day, 9);  startdate.set(calendar.minute, 45);  startdate.set(calendar.second, 00);    scheduleclass scheduleclass = new scheduleclass();  gtimer.schedule(scheduleclass, startdate.gettime(), 1000 * 60 * 2); //interval 2 minutes

this snippet of scheduleclass has run function , successful run every 2 minutes. question is: how can set interval every 2, 5 , 7 minutes?

when copy scheduler 3 times throws error:

severe: standardwrapper.throwable

java.lang.illegalstateexception: task scheduled or cancelled`

all suggestions welcome!


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -