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

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

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

Handler.sendEmptyMessage介绍

暂无

代码示例

代码示例来源:origin: google/ExoPlayer

/**
 * Notifies the sampler that a {@link VideoFrameReleaseTimeHelper} is observing
 * {@link #sampledVsyncTimeNs}, and hence that the value should be periodically updated.
 */
public void addObserver() {
 handler.sendEmptyMessage(MSG_ADD_OBSERVER);
}

代码示例来源:origin: google/ExoPlayer

/**
 * Notifies the sampler that a {@link VideoFrameReleaseTimeHelper} is no longer observing
 * {@link #sampledVsyncTimeNs}.
 */
public void removeObserver() {
 handler.sendEmptyMessage(MSG_REMOVE_OBSERVER);
}

代码示例来源:origin: square/picasso

void dispatchCacheMiss() {
 handler.sendEmptyMessage(CACHE_MISS);
}

代码示例来源:origin: square/picasso

void dispatchCacheHit() {
 handler.sendEmptyMessage(CACHE_HIT);
}

代码示例来源:origin: google/ExoPlayer

@Override
public boolean sendEmptyMessage(int what) {
 return handler.sendEmptyMessage(what);
}

代码示例来源:origin: google/ExoPlayer

@Override
public boolean sendEmptyMessage(int what) {
 return handler.sendEmptyMessage(what);
}

代码示例来源:origin: lingochamp/FileDownloader

private void unFreezeSerialHandler(Handler handler) {
    handler.sendEmptyMessage(WHAT_UNFREEZE);
  }
}

代码示例来源:origin: lingochamp/FileDownloader

private void freezeSerialHandler(Handler handler) {
  handler.sendEmptyMessage(WHAT_FREEZE);
}

代码示例来源:origin: lingochamp/FileDownloader

private void sendNext() {
  mHandler.sendEmptyMessage(WHAT_NEXT);
}

代码示例来源:origin: google/ExoPlayer

private VSyncSampler() {
 sampledVsyncTimeNs = C.TIME_UNSET;
 choreographerOwnerThread = new HandlerThread("ChoreographerOwner:Handler");
 choreographerOwnerThread.start();
 handler = Util.createHandler(choreographerOwnerThread.getLooper(), /* callback= */ this);
 handler.sendEmptyMessage(CREATE_CHOREOGRAPHER);
}

代码示例来源:origin: google/ExoPlayer

public void release() {
 Assertions.checkNotNull(handler);
 handler.sendEmptyMessage(MSG_RELEASE);
}

代码示例来源:origin: google/ExoPlayer

@Override
public boolean sendEmptyMessage(int what) {
 return handler.sendEmptyMessage(what);
}

代码示例来源:origin: TeamNewPipe/NewPipe

public void resumeMission(DownloadMission mission) {
  if (!mission.running) {
    mission.start();
    mHandler.sendEmptyMessage(DownloadManagerService.MESSAGE_RUNNING);
  }
}

代码示例来源:origin: aa112901/remusic

private void onProgressChanged() {
    if (mProgressStyle == STYLE_HORIZONTAL) {
      if (mViewUpdateHandler != null && !mViewUpdateHandler.hasMessages(0)) {
        mViewUpdateHandler.sendEmptyMessage(0);
      }
    }
  }
}

代码示例来源:origin: Bigkoo/Android-PickerView

@Override
public void onClick(View v) {
  switch (v.getId()) {
    case R.id.btn_data:
      mHandler.sendEmptyMessage(MSG_LOAD_DATA);
      break;
    case R.id.btn_show:
      if (isLoaded) {
        showPickerView();
      } else {
        Toast.makeText(JsonDataActivity.this, "Please waiting until the data is parsed", Toast.LENGTH_SHORT).show();
      }
      break;
  }
}

代码示例来源:origin: Bigkoo/Android-PickerView

public ArrayList<JsonBean> parseData(String result) {//Gson 解析
  ArrayList<JsonBean> detail = new ArrayList<>();
  try {
    JSONArray data = new JSONArray(result);
    Gson gson = new Gson();
    for (int i = 0; i < data.length(); i++) {
      JsonBean entity = gson.fromJson(data.optJSONObject(i).toString(), JsonBean.class);
      detail.add(entity);
    }
  } catch (Exception e) {
    e.printStackTrace();
    mHandler.sendEmptyMessage(MSG_LOAD_FAILED);
  }
  return detail;
}

代码示例来源:origin: lingochamp/FileDownloader

private void ensureCacheToDB(int id) {
  handler.removeMessages(id);
  if (handlingId.get() == id) {
    parkThread = Thread.currentThread();
    handler.sendEmptyMessage(WHAT_CLEAN_LOCK);
    LockSupport.park();
  } else {
    syncCacheToDB(id);
  }
}

代码示例来源:origin: TeamNewPipe/NewPipe

public void deleteMission(Mission mission) {
  synchronized (this) {
    if (mission instanceof DownloadMission) {
      mMissionsPending.remove(mission);
    } else if (mission instanceof FinishedMission) {
      mMissionsFinished.remove(mission);
      mDownloadDataSource.deleteMission(mission);
    }
    mHandler.sendEmptyMessage(DownloadManagerService.MESSAGE_DELETED);
    mission.delete();
  }
}

代码示例来源: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: robolectric/robolectric

@Test
public void sendEmptyMessage_addMessageToQueue() {
 ShadowLooper.pauseMainLooper();
 Handler handler = new Handler();
 assertThat(handler.hasMessages(123)).isFalse();
 handler.sendEmptyMessage(123);
 assertThat(handler.hasMessages(456)).isFalse();
 assertThat(handler.hasMessages(123)).isTrue();
 ShadowLooper.idleMainLooper(0);
 assertThat(handler.hasMessages(123)).isFalse();
}

相关文章