Handler obtainMessage - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Handler obtainMessage method.

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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: obtainMessage, removeMessages, sendMessage, sendMessageDelayed
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Handler obtainMessage Questions & Answers:

obtainMessage Method Overview
Same as obtainMessage(), except that it also sets the what, arg1 and arg2 members of the returned Message.
See Code Examples for other Android Handler Methods: