Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9246027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:23:53+00:00 2026-06-18T09:23:53+00:00

The android Handler class contains this method: public final boolean postAtTime (Runnable r, Object

  • 0

The android Handler class contains this method:

public final boolean postAtTime (Runnable r, Object token, long uptimeMillis)

to post a Runnable at a given time. The token can be used later to remove the callback to r from the message queue thanks to this method:

public final void removeCallbacks (Runnable r, Object token)

The following method doesn’t exist in the Handler class

public final boolean postDelayed (Runnable r, Object token, long delay)

Is there a good reason for not providing such a method?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:23:54+00:00Added an answer on June 18, 2026 at 9:23 am

    After looking at the source code, the token object eventually passes to the Message:

    public final boolean postAtTime(Runnable r, Object token, long uptimeMillis)
    308    {
    309        return sendMessageAtTime(getPostMessage(r, token), uptimeMillis);
    310    }
    
    private static Message getPostMessage(Runnable r, Object token) {
    608        Message m = Message.obtain();
    609        m.obj = token;
    

    And postDelay

     public final boolean postDelayed(Runnable r, long delayMillis)
    330    {
    331        return sendMessageDelayed(getPostMessage(r), delayMillis);
    332    }
    

    If what you want is

    public final boolean postDelayed (Runnable r, Object token, long delay)
    

    Then why not just use

    public final boolean postAtTime (Runnable r, Object token, long uptimeMillis)
    

    since its the same.

    Update, forgot to add this:

    public final boolean sendMessageDelayed(Message msg, long delayMillis)
    442    {
    443        if (delayMillis < 0) {
    444            delayMillis = 0;
    445        }
    446        return sendMessageAtTime(msg, SystemClock.uptimeMillis() + delayMillis);
    447    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a database in android using this code: public class PackageDBHelper extends
I have a class extending android.os.Handler . An instance of this handler is passed
import java.lang.ref.SoftReference; import java.util.HashMap; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Message; public class AsyncImageLoader {
I've got an android app, with a super-class that contains a layout that should
I have a database that I have created with the following handler: public class
I have a Java handler code which Im using in android to run a
In my android project I added a library jar into the libs folder. This
I'm creating Android application contains 2 buttons, on click on each button play a
I just begun with a simple thread handler program on Android. The code works.
My LocalService.java contains a class LocalBinder that defines the methods that are declared in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.