Created
December 15, 2019 15:15
-
-
Save sontqq/521de73b4ae32cfaf9f6ab4a5051ad2e to your computer and use it in GitHub Desktop.
Android Java - How to run repetitive tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Timer().scheduleAtFixedRate(new TimerTask() { | |
@Override | |
public void run() { | |
method_call(); | |
} | |
}, 0, 10000); | |
android.os.Handler handler = new android.os.Handler(); | |
handler.postDelayed(new Runnable(){ | |
public void run(){ | |
method_call(); | |
handler.postDelayed(this, 10000); | |
} | |
}, 10000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment