0

Here is my code,

private int V_Time = 1;

.
.
.

try {
final Timer V_Timer;
final Handler V_Handler;
V_Timer = new Timer();
V_Handler = new Handler(Looper.getMainLooper());
V_Timer.scheduleAtFixedRate(new TimerTask() {
    public void run() {
        V_Handler.post(new Runnable() {
            public void run() {
            webservice_method();
            V_Time = 2; 

            }
        });
    }
}, 0, V_Time * 1000 * 60);
} catch (Exception hata) {

}

V_time changes what returns from web service, it seems right in logs altough, it runs every minute. How can set it programmitacally what come form web service? Ps: I tried private long V_Time = 1; , private static long V_Time = 1; etc...

edit:Can I use cancel() run() etc..? in somewhere?

John simit
  • 1,305
  • 2
  • 11
  • 14
  • how do you check the V_Time value is changed? – Blackbelt May 23 '13 at 08:51
  • hata.printStackTrace(). Otherwise you risk your app silently crashing without you having any idea why. Anyway, i don't understand your question. What webservice? – njzk2 May 23 '13 at 08:53
  • Maybe he wants to change dinamically next "time in milliseconds between successive task executions" ? – Blackbelt May 23 '13 at 08:54
  • call webservice every second and get update ui in runonuithread.. – QuokMoon May 23 '13 at 09:22
  • blackbelt is it check every timer run? eg first timer run 1 minute later, then check it and change v_time and second timer run 2 minutes later? njzk2 .net webservice call with ksoap2, it is in the timer. I want just set timer time remote in every timer running... altaf I do not understand, it calls web service every V_time time, it must be progammitically way to change it? – John simit May 23 '13 at 09:52
  • still I can not understand what you want to achieve – Blackbelt May 24 '13 at 08:38

0 Answers0