Last active
December 15, 2017 17:36
-
-
Save martinomburajr/afa124fc0dc2d9f261cc7c8587c2038b to your computer and use it in GitHub Desktop.
The Looper loop function
This file contains hidden or 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
| /** | |
| * AOSP | |
| * Looper class | |
| */ | |
| public static void loop() { | |
| final Looper me = myLooper(); | |
| if (me == null) { | |
| throw new RuntimeException("No Looper; Looper.prepare() wasn't called on this thread."); | |
| } | |
| final MessageQueue queue = me.mQueue; | |
| //code removed | |
| for (;;) { | |
| Message msg = queue.next(); // might block | |
| if (msg == null) { | |
| // No message indicates that the message queue is quitting. | |
| return; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment