Handler sendEmptyMessageDelayed - 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 sendEmptyMessageDelayed 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
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
This code example shows how to use the following methods:removeMessages, sendEmptyMessageDelayed
        writeEntropy(); 
        scheduleEntropyWriter(); 
    } 
 
    private void scheduleEntropyWriter() { 
        mHandler.removeMessages(ENTROPY_WHAT);
        mHandler.sendEmptyMessageDelayed(ENTROPY_WHAT, ENTROPY_WRITE_PERIOD);
    } 
 
    private void loadInitialEntropy() { 
        try { 
            RandomBlock.fromFile(ENTROPY_FILENAME).toFile(RANDOM_DEV);
        } catch (IOException e) {
            Log.w(TAG, "unable to load initial entropy (first boot?)", e);
        } 
    } 
 
    private void writeEntropy() { 
        try { 
            RandomBlock.fromFile(RANDOM_DEV).toFile(ENTROPY_FILENAME);
6
CodeRank
This code example shows how to use the following methods:sendEmptyMessageDelayed
    } 
 
    @Override 
    protected void onAttachedToWindow() { 
        super.onAttachedToWindow(); 
        mHandler.sendEmptyMessageDelayed(MSG_TICK, TICK_DELAY);
    } 
 
    @Override 
    protected void onDetachedFromWindow() { 
        super.onDetachedFromWindow(); 
        mHandler.removeMessages(MSG_TICK);
    } 
 
    @Override 
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawColor(0xff000000);
        mPaint.setTextSize(mRandom.nextInt(40) + 10);
        mPaint.setColor(0xff000000 + mRandom.nextInt(0x1000000));
6
CodeRank
This code example shows how to use the following methods:removeMessages, sendEmptyMessageDelayed
        if (mFocusAreaSupported) {
            autoFocus(); 
        } else {  // Just show the indicator in all other cases. 
            updateFocusUI(); 
            // Reset the metering area in 3 seconds. 
            mHandler.removeMessages(RESET_TOUCH_FOCUS);
            mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, RESET_TOUCH_FOCUS_DELAY);
        } 
    } 
 
    public void onPreviewStarted() { 
        mState = STATE_IDLE;
    } 
 
    public void onPreviewStopped() { 
        // If auto focus was in progress, it would have been stopped. 
        mState = STATE_IDLE;
        resetTouchFocus(); 
        updateFocusUI(); 
    } 

6
CodeRank
This code example shows how to use the following methods:removeMessages, sendEmptyMessageDelayed
                mBlinkRect.set(MARGIN + x * sxy, MARGIN + y * sxy,
                               MARGIN + (x + 1) * sxy, MARGIN + (y + 1) * sxy);
 
                if (state != State.EMPTY) {
                    // Start the blinker 
                    mHandler.sendEmptyMessageDelayed(MSG_BLINK, FPS_MS);
                } 
 
                if (mCellListener != null) {
                    mCellListener.onCellSelected();
                } 
            } 
 
            return true; 
        } 
 
        return false; 
    } 
 
    public void stopBlink() { 

6
CodeRank
This code example shows how to use the following methods:sendEmptyMessageDelayed
        Log.d("Notifications", "START");
        // Toast.makeText(mContext, "Start!!!!", 
        // Constant.DEFAULT_TOAST_DISPLAY_TIME).show(); 
        final long update_interval = 20 * 1000;
        if (update_interval <= 0) return false;
        mHandler.sendEmptyMessageDelayed(ACTION_AUTO_REFRESH, update_interval);
        return true; 
        // } 
        // return false; 
    } 
 
    public void stopAutoRefresh() { 
        mHandler.removeMessages(ACTION_AUTO_REFRESH);
    } 
 
    /* 
	 *  
	 */ 
    public static boolean isRunning() { 
        return mIsRunning;
6
CodeRank
This code example shows how to use the following methods:sendEmptyMessageDelayed
    protected void onStart() { 
        if (mShowWarningIcon) {
            // Disable keyguard 
            mKeyguardLock.disableKeyguard();
            // start icon animation 
            mAnimationHandler.sendEmptyMessageDelayed(0, WARNING_ICON_ON_DURATION_MSEC);
        } 
    } 
 
    /** 
     * Stop animating warning icon and stop the {@link CellBroadcastAlertAudio} 
     * service if necessary. 
     */ 
    @Override 
    protected void onStop() { 
        // Stop playing alert sound/vibration/speech (if started) 
        Context context = getContext();
        context.stopService(new Intent(context, CellBroadcastAlertAudio.class));
        // Start database service to mark broadcast as read 
        Intent intent = new Intent(context, CellBroadcastDatabaseService.class);
6
CodeRank
This code example shows how to use the following methods:sendEmptyMessageDelayed
    private synchronized void releaseCamera() { 
        Assert(mUsers == 0);
        Assert(mCameraDevice != null);
        long now = System.currentTimeMillis();
        if (now < mKeepBeforeTime) {
            mHandler.sendEmptyMessageDelayed(RELEASE_CAMERA,
                    mKeepBeforeTime - now);
            return; 
        } 
        mCameraDevice.release();
        mCameraDevice = null;
        // We must set this to null because it has a reference to Camera. 
        // Camera has references to the listeners. 
        mParameters = null;
        mCameraId = -1;
    } 
 
    public synchronized void keep() { 
        // We allow (mUsers == 0) for the convenience of the calling activity. 
        // The activity may not have a chance to call open() before the user 
6
CodeRank
This code example shows how to use the following methods:removeMessages, sendEmptyMessageDelayed
     * is updated after a delay to allow the user to type without to much UI churn 
     * and to save bandwidth on directory queries. 
     */ 
    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); 
        } 
    } 
 
    protected void selectDefaultContact() { 
        Uri contactUri = null;
        ContactListAdapter adapter = getAdapter();
6
CodeRank

Related Handler sendEmptyMessageDelayed Questions & Answers:

sendEmptyMessageDelayed Method Overview
Sends a Message containing only the what value, to be delivered after the specified amount of time elapses.
See Code Examples for other Android Handler Methods: