diff --git a/app/src/main/java/org/ntlab/irisclient/viewmodels/TimerViewModel.java b/app/src/main/java/org/ntlab/irisclient/viewmodels/TimerViewModel.java index 9254669..ad31daf 100644 --- a/app/src/main/java/org/ntlab/irisclient/viewmodels/TimerViewModel.java +++ b/app/src/main/java/org/ntlab/irisclient/viewmodels/TimerViewModel.java @@ -8,7 +8,9 @@ import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; - import java.util.ArrayList; +import org.ntlab.irisclient.Iris; + +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Random; @@ -21,6 +23,7 @@ abstract class TimerViewModel extends ViewModel implements Runnable { private ScheduledThreadPoolExecutor thread = null; + protected Iris iris; //----------------------------------------------------------------- @@ -34,7 +37,8 @@ //----------------------------------------------------------------- //何ミリ秒ごとにrun()を実行するかを決める - public void start(int interval) { + public void start(int interval,Iris iris) { + this.iris = iris; thread = new ScheduledThreadPoolExecutor(1); thread.scheduleWithFixedDelay(this, interval, 1000L, TimeUnit.MILLISECONDS); }