Answer the question
In order to leave comments, you need to log in
How to make an eternal loop with processing every 100 milliseconds (Android)?
It is necessary after starting the program every 100 - 200 milliseconds to interrogate the device and receive a response.
How to write such a loop that processes everything that is in it every 100 - 200 milliseconds?
P.S. The millisecond value must be stored in an int variable
Answer the question
In order to leave comments, you need to log in
You can use the standard Java timer
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
public class App
{
public static void main( String[] args )
{
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
System.out.println("Hello");
}
}, new Date(), 100);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question