Handler removeMessages - 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 removeMessages method.

This code example shows how to use the following methods:removeMessages, sendEmptyMessageDelayed
			handled = super.onTouchEvent(ev);
		} 
		return handled;
	} 
 
	@Override 
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
	{ 
		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
 
		int maxWidth = 0;
		int maxHeight = 0;
 
//		if (DBG) { 
//			int w = MeasureSpec.getSize(widthMeasureSpec); 
//			int wm = MeasureSpec.getMode(widthMeasureSpec); 
//			int h = MeasureSpec.getSize(heightMeasureSpec); 
//			int hm = MeasureSpec.getMode(heightMeasureSpec); 
// 
//			Log.i(LCAT, "w: " + w + " wm: " + wm + " h: " + h + " hm: " + hm); 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
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();
 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:obtainMessage, removeMessages, sendMessage, sendMessageDelayed
 
        String url = ( String ) msg.obj;
        if ( msg.what == GET_REMOTE_IMAGE )
        { 
            // while decoding the new image, show the default album art 
            Message numsg = mParentHandler
                    .obtainMessage( REMOTE_IMAGE_DECODED, null );
            mParentHandler.removeMessages( REMOTE_IMAGE_DECODED );
            mParentHandler.sendMessageDelayed( numsg, 300 );
            Bitmap bm = getArtwork( url );
            if ( bm != null )
            { 
                numsg = mParentHandler.obtainMessage( REMOTE_IMAGE_DECODED, bm );
                mParentHandler.removeMessages( REMOTE_IMAGE_DECODED );
                mParentHandler.sendMessage( numsg );
            } 
        } 
    } 
     
    private Bitmap getArtwork( String urlstr )
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeMessages, sendEmptyMessageDelayed
		return m;
	} 
 
	private void scheduleControlTimeout() 
	{ 
		handler.removeMessages(MSG_HIDE_CONTROLS);
		handler.sendEmptyMessageDelayed(MSG_HIDE_CONTROLS, CONTROL_TIMEOUT);
	} 
 
	@Override 
	public boolean onTouchEvent(MotionEvent ev)
	{ 
		boolean handled = false;
		if (enableZoomControls) {
			if (zoomControls.getVisibility() == View.VISIBLE) {
				zoomControls.onTouchEvent(ev);
			} 
			handled = gestureDetector.onTouchEvent(ev);
		} 
		if (!handled) {
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:obtainMessage, removeMessages, sendMessage
	public static synchronized void sendBTCMotorMessage(int delay, int motor, int speed, int angle) {
		Bundle myBundle = new Bundle();
		myBundle.putInt("motor", motor);
		myBundle.putInt("speed", speed);
		myBundle.putInt("angle", angle);
		Message myMessage = btcHandler.obtainMessage();
		myMessage.setData(myBundle);
		myMessage.what = motor;
 
		if (delay == 0) {
 
			btcHandler.removeMessages(motor);
			btcHandler.sendMessage(myMessage);
 
		} else { 
			//btcHandler.removeMessages(motor); 
			btcHandler.sendMessageDelayed(myMessage, delay);
 
		} 
	} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:obtainMessage, removeMessages, sendMessageDelayed
    /** 
     * Start up the pulse to fade the screen, clearing any existing pulse to 
     * ensure that we don't have multiple pulses running at a time. 
     */ 
    void startFading() { 
        mHandler.removeMessages(MSG_FADE);
        scheduleFade(); 
    } 
 
    /** 
     * Stop the pulse to fade the screen. 
     */ 
    void stopFading() { 
        mHandler.removeMessages(MSG_FADE);
    } 
 
    /** 
     * Schedule a fade message for later. 
     */ 
    void scheduleFade() { 

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:obtainMessage, removeMessages, sendMessage
	public static synchronized void sendBTCMotorMessage(int delay, int motor, int speed, int angle) {
		Bundle myBundle = new Bundle();
		myBundle.putInt("motor", motor);
		myBundle.putInt("speed", speed);
		myBundle.putInt("angle", angle);
		Message myMessage = btcHandler.obtainMessage();
		myMessage.setData(myBundle);
		myMessage.what = motor;
 
		if (delay == 0) {
 
			btcHandler.removeMessages(motor);
			btcHandler.sendMessage(myMessage);
 
		} else { 
			//btcHandler.removeMessages(motor); 
			btcHandler.sendMessageDelayed(myMessage, delay);
 
		} 
	} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeMessages, sendEmptyMessage
     *  
     * @param message the message to set 
     */ 
    private void setNextMessage(int message) {
        clearMessages(); 
        animationHandler.sendEmptyMessage(message);
    } 
 
    /** 
     * Clears messages from queue 
     */ 
    private void clearMessages() { 
        animationHandler.removeMessages(MESSAGE_SCROLL);
        animationHandler.removeMessages(MESSAGE_JUSTIFY);
    } 
     
    // animation handler 
    private Handler animationHandler = new Handler() {
        public void handleMessage(Message msg) { 
            scroller.computeScrollOffset(); 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:obtainMessage, removeMessages, sendMessageDelayed
	private void handleIntent(Intent intent) {
		mProcessor.execute(intent);
	} 
	 
	private void sendStopMessage(Intent request) {
		mHandler.removeMessages(MSG_STOP);
		int startId = request.getIntExtra(EXTRA_START_ID, 0);
		mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_STOP, startId, 0), getIdleStopTime());
	} 
 
	protected long getIdleStopTime() { 
		return 10000; // 10 seconds 
	} 
 
	private void stop(int startId) {
		if(shouldStopOnAllOperationsComplete() && stopSelfResult(startId)) {
			if(mEnableLogging) {
				Log.d(mLogTag, String.format("[Stopping] startId:%s", startId));
			} 
			 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeMessages, sendEmptyMessage
 
	@Override 
	protected void drawableStateChanged() { 
		super.drawableStateChanged(); 
		int delta = isPressed()? 1 : -1;
		handler.removeMessages(-delta);
		handler.sendEmptyMessage(delta);
	} 
	 
	private Handler handler = new Handler() {
		@Override 
		public void handleMessage(Message msg) { 
			int what = msg.what; 
 
			level += what; 
			if (level >= 0 && level < transitionDrawableLength) { 
				transitionDrawable.setLevel(level); 
		        if (colors != null) { 
		        	setTextColor(colors[level]); 
		        } 
6
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Handler removeMessages Questions & Answers:

removeMessages Method Overview
Remove any pending posts of messages with code 'what' that are in the message queue.
See Code Examples for other Android Handler Methods: