// android.os.Looper.java publicstaticvoidloop() { finalLooperme= myLooper(); finalMessageQueuequeue= me.mQueue; ... for (;;) { Messagemsg= queue.next(); // might block ... // This must be in a local variable, in case a UI event sets the logger finalPrinterlogging= me.mLogging; if (logging != null) { logging.println(">>>>> Dispatching to " + msg.target + " " + msg.callback + ": " + msg.what); } ... msg.target.dispatchMessage(msg); ... if (logging != null) { logging.println("<<<<< Finished to " + msg.target + " " + msg.callback); } ... } } /** * Control logging of messages as they are processed by this Looper. If * enabled, a log message will be written to <var>printer</var> * at the beginning and ending of each message dispatch, identifying the * target Handler and message contents. * * @param printer A Printer object that will receive log messages, or * null to disable message logging. */ publicvoidsetMessageLogging(@Nullable Printer printer) { mLogging = printer; }