Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 0.44 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Does handler.post(Runnable r) block the MessageQueue?
  2. public final void runOnUiThread(Runnable action) {
  3.     if (Thread.currentThread() != mUiThread) {
  4.         mHandler.post(action);
  5.     } else {
  6.         action.run();
  7.     }
  8. }
  9.        
  10. public final boolean post(Runnable r)
  11. {
  12.    return  sendMessageDelayed(getPostMessage(r), 0);
  13. }
  14.        
  15. private final Message getPostMessage(Runnable r) {
  16.     Message m = Message.obtain();
  17.     m.callback = r;
  18.     return m;
  19. }