Timer time does not change as variable?

左心房为你撑大大i 提交于 2019-12-04 06:19:34

问题


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?

来源:https://stackoverflow.com/questions/16709439/timer-time-does-not-change-as-variable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!