Skip to content

Instantly share code, notes, and snippets.

@martinomburajr
Last active December 15, 2017 17:36
Show Gist options
  • Select an option

  • Save martinomburajr/afa124fc0dc2d9f261cc7c8587c2038b to your computer and use it in GitHub Desktop.

Select an option

Save martinomburajr/afa124fc0dc2d9f261cc7c8587c2038b to your computer and use it in GitHub Desktop.
The Looper loop function
/**
* 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