Created
June 24, 2019 10:44
-
-
Save jddeep/dd43bd39fc280feb0ceab514a9054ee8 to your computer and use it in GitHub Desktop.
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
private void feedMultiple() { | |
if (thread != null) | |
thread.interrupt(); | |
final Runnable runnable = () -> addEntry(); | |
thread = new Thread(() -> { | |
for (int i = 0; i < 1000; i++) { | |
// Don't generate garbage runnables inside the loop. | |
runOnUiThread(runnable); | |
try { | |
Thread.sleep(25); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
} | |
}); | |
thread.start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment