Example usage for android.os Handler removeMessages

List of usage examples for android.os Handler removeMessages

Introduction

In this page you can find the example usage for android.os Handler removeMessages.

Prototype

public final void removeMessages(int what) 

Source Link

Document

Remove any pending posts of messages with code 'what' that are in the message queue.

Usage

From source file:ac.robinson.mediaphone.activity.TemplateBrowserActivity.java

private void postUpdateTemplateIcons() {
    mPendingIconsUpdate = true;//w  w  w . jav  a2s. co m
    Handler handler = mScrollHandler;
    handler.removeMessages(R.id.msg_update_template_icons);
    Message message = handler.obtainMessage(R.id.msg_update_template_icons, TemplateBrowserActivity.this);
    handler.sendMessage(message);
}

From source file:com.silentcircle.contacts.list.ScContactBrowseListFragment.java

/**
 * Automatically selects the first found contact in search mode.  The selection
 * is updated after a delay to allow the user to type without to much UI churn
 * and to save bandwidth on directory queries.
 *//*from www  .  ja  va  2  s  .  c  o m*/
public void selectFirstFoundContactAfterDelay() {
    Handler handler = getHandler();
    handler.removeMessages(MESSAGE_AUTOSELECT_FIRST_FOUND_CONTACT);

    String queryString = getQueryString();
    if (queryString != null && queryString.length() >= AUTOSELECT_FIRST_FOUND_CONTACT_MIN_QUERY_LENGTH) {
        handler.sendEmptyMessageDelayed(MESSAGE_AUTOSELECT_FIRST_FOUND_CONTACT,
                DELAY_AUTOSELECT_FIRST_FOUND_CONTACT_MILLIS);
    } else {
        setSelectedContactUri(null, false, false, false, false);
    }
}

From source file:com.example.linhdq.test.documents.viewing.grid.DocumentGridActivity.java

private void postDocumentThumbnails() {
    Handler handler = mScrollHandler;
    Message message = handler.obtainMessage(MESSAGE_UPDATE_THUMNAILS, DocumentGridActivity.this);
    handler.removeMessages(MESSAGE_UPDATE_THUMNAILS);
    mPendingThumbnailUpdate = true;//w  w w .  java2s  .c om
    handler.sendMessage(message);
}