Code example for Handler

Methods: obtainMessageremoveMessagessendMessageDelayed

0
        scheduleSuggestionLookup(); 
    } 
 
    protected void scheduleSuggestionLookup() { 
        Handler handler = getHandler();
        handler.removeMessages(MESSAGE_NAME_CHANGE);
 
        if (mSuggestionsUri == null) {
            return; 
        } 
 
        Message msg = handler.obtainMessage(MESSAGE_NAME_CHANGE, mSuggestionsUri);
        handler.sendMessageDelayed(msg, SUGGESTION_LOOKUP_DELAY_MILLIS);
    } 
 
    private Uri buildAggregationSuggestionUri(ValuesDelta values) {
        StringBuilder nameSb = new StringBuilder();
        appendValue(nameSb, values, StructuredName.PREFIX);
        appendValue(nameSb, values, StructuredName.GIVEN_NAME);
        appendValue(nameSb, values, StructuredName.MIDDLE_NAME);
        appendValue(nameSb, values, StructuredName.FAMILY_NAME);