timer - Do after specific time, Android Runnable -
Ive found an app with a square that implements Runnable where a thread starts and runs () method overrides It runs my graphics.
1. Question: How many times is called ()? I have set a time for it so it should be a default value?
2. Question: I should do stuff after a certain time (2 minutes, 5 minutes, 10 minutes) etc. What would be the best way to do this, I was thinking about using an integer as a counter and once it hits a specific value, what do I want?
1. Question: How many times is the run ()? I have set a time for it, so it should be a default value? Your thread is called the 2. Question: I should be made after certain time (2 minutes, 5 minutes, 10 minutes) etc. What would be the best way to go about doing this, I was thinking of using an int as a counter and once I assume it is a specific, what do I need? You can call the Or you can do it as described above, in your I hope it will be helpful. run () method when you call it for example.
yourThread.start ();
thread, sleep () method (NB: Never make it in your UI thread).
run () method you will have a
while () loop and on each recurrence Check if the current time difference in last update and milliseconds is greater than the desired period eg. 2 minutes, 5 minutes or 10 minutes.
Comments
Post a Comment