Best code examples for Handler sendMessage method (android.os.Handler.sendMessage)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Handler sendMessage method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Handler sendMessage examples from Open Source projects
This code example shows how to use the following methods: obtainMessage, sendMessage
     */ 
    @Override 
    public int onStartCommand(Intent intent, int flags, int startId) {
        if (DBG) Slog.d(TAG, "onStartCommand");
 
        Message msg = mHandler.obtainMessage();
        msg.what = CMD_ASYNC_SERVICE_ON_START_INTENT;
        msg.arg1 = flags;
        msg.arg2 = startId;
        msg.obj = intent;
        mHandler.sendMessage(msg);
 
        return mAsyncServiceInfo.mRestartFlags;
    } 
 
    /** 
     * Called when service is destroyed. After returning the 
     * service is dead and no more processing should be expected 
     * to occur. 
     */ 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: obtainMessage, removeMessages, sendMessage
 
        absListView.invalidate();
    } 
 
    private void postUpdateItems() { 
        Message msg = mHandler.obtainMessage(MESSAGE_UPDATE_ITEMS,
                                             ItemManager.this);
 
        mHandler.removeMessages(MESSAGE_UPDATE_ITEMS);
        mPendingItemsUpdate = true;
 
        mHandler.sendMessage(msg);
    } 
 
    void setItemManaged(ItemManaged itemManaged) {
        mManaged = itemManaged;
 
        if (mManaged != null) {
            AbsListView absListView = mManaged.getAbsListView();
 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: obtainMessage, sendMessage
		@Override 
		public void onReceive(Context context, Intent intent) {
			int intExtra = intent.getIntExtra("tab", 0);
			Log.i(TabChangeReceiver.class.getSimpleName(), "Recieved broadcast with extra=[" + intExtra + "]");
			 
			mHandler.sendMessage(mHandler.obtainMessage(SWITCH_TAB, intExtra, 0));
		} 
	} 
	 
	private TabHost host;
	public static final int SWITCH_TAB = 2545;
	protected static TabChangeReceiver receiver;
	 
} 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: obtainMessage, removeMessages, sendMessage, sendMessageDelayed
This code example shows how to use the following methods: obtainMessage, sendMessage
            executeMessage(msg);
            msg.recycle();
            return; 
        } 
         
        mH.sendMessage(msg);
    } 
     
    void executeMessage(Message msg) {
        switch (msg.what) {
            case DO_GET_TEXT_AFTER_CURSOR: {
                SomeArgs args = (SomeArgs)msg.obj;
                try { 
                    InputConnection ic = mInputConnection.get();
                    if (ic == null || !isActive()) {
                        Log.w(TAG, "getTextAfterCursor on inactive InputConnection");
                        args.callback.setTextAfterCursor(null, args.seq);
                        return; 
                    } 
                    args.callback.setTextAfterCursor(ic.getTextAfterCursor(

7
CodeRank
Related Handler sendMessage Questions & Answers:
sendMessage Method Overview
Pushes a message onto the end of the message queue after all pending messages before the current time.
See Code Examples for other Android Handler Methods: