从函数启动ScheduledExecutorService

时间:2015-09-16 22:15:17

标签: android multithreading

这在onCreate()

中效果很好
scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() {
            public void run() {
                Calculate_Run();

                runOnUiThread(new Runnable() {
                    public void run() {
                        tv_inseconds.setText(timer_seconds);
                        tv_inminutes.setText(timer_minutes);
                    }
                });
            }
        }, 0, 1, TimeUnit.SECONDS);

如何从函数中调用它?我想在用户按下按钮时启动此线程。

0 个答案:

没有答案
相关问题