android.os.Handler.sendMessageAtFrontOfQueue()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(382)

本文整理了Java中android.os.Handler.sendMessageAtFrontOfQueue()方法的一些代码示例,展示了Handler.sendMessageAtFrontOfQueue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Handler.sendMessageAtFrontOfQueue()方法的具体详情如下:
包路径:android.os.Handler
类名称:Handler
方法名:sendMessageAtFrontOfQueue

Handler.sendMessageAtFrontOfQueue介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldRemoveMessageFromQueueBeforeDispatching() throws Exception {
 Handler h = new Handler(Looper.myLooper()) {
  @Override
  public void handleMessage(Message msg) {
   assertFalse(hasMessages(0));
  }
 };
 h.sendEmptyMessage(0);
 h.sendMessageAtFrontOfQueue(h.obtainMessage());
}

代码示例来源:origin: android-hacker/VirtualXposed

getH().sendMessageAtFrontOfQueue(Message.obtain(msg));
return false;
getH().sendMessageAtFrontOfQueue(Message.obtain(msg));
return false;

代码示例来源:origin: robolectric/robolectric

@Test
public void testSendMessageAtFrontOfQueueThenRunMainLooperOneMsgAtATime_shouldRunFrontOfQueueMsgFirst() throws Exception {
 Handler handler = new Handler();
 ShadowLooper.pauseMainLooper();
 // Post two messages to handler. Handle first message and confirm that msg posted
 // to front is removed.
 handler.obtainMessage(123).sendToTarget();
 Message frontMsg = handler.obtainMessage(345);
 boolean result = handler.sendMessageAtFrontOfQueue(frontMsg);
 assertTrue(result);
 assertTrue(handler.hasMessages(123));
 assertTrue(handler.hasMessages(345));
 ShadowLooper.runMainLooperOneTask();
 assertTrue(handler.hasMessages(123));
 assertFalse(handler.hasMessages(345));
 ShadowLooper.runMainLooperOneTask();
 assertFalse(handler.hasMessages(123));
 assertFalse(handler.hasMessages(345));
}

代码示例来源:origin: AndBible/and-bible

@Override
  public void run() {
    Log.d(TAG, "Tilt-Scroll loop starting");
    while (isContinue) {
      try {
        TiltScrollInfo tiltScrollInfo = pageTiltScrollControl.getTiltScrollInfo();
        if (tiltScrollInfo.scrollPixels!=0) {
          Message msg = new Message();
          Bundle b = new Bundle();
          b.putInt(SCROLL_PIXELS_KEY, tiltScrollInfo.scrollPixels);
          b.putBoolean(FORWARD_KEY, tiltScrollInfo.forward);
          msg.setData(b);
          mScrollMsgHandler.sendMessageAtFrontOfQueue(msg);
        }
        if (pageTiltScrollControl.isTiltScrollEnabled()) {
          long delay = mIsScrolling ? tiltScrollInfo.delayToNextScroll : TiltScrollInfo.TIME_TO_POLL_WHEN_NOT_SCROLLING;
          Thread.sleep(delay);
        } else {
          isContinue = false;
        }
       } catch (Exception e) {
         Log.v("Error", e.toString());
         isContinue = false;
       }
    }
    Log.d(TAG, "Tilt-Scroll loop exiting");
  }
}

代码示例来源:origin: darkskygit/VirtualApp

getH().sendMessageAtFrontOfQueue(Message.obtain(msg));
return false;
getH().sendMessageAtFrontOfQueue(Message.obtain(msg));
return false;

代码示例来源:origin: bzsome/VirtualApp-x326

getH().sendMessageAtFrontOfQueue(Message.obtain(msg));
return false;
getH().sendMessageAtFrontOfQueue(Message.obtain(msg));
return false;

相关文章