Reputation: 3103
In Android platform, a View object has an instance method postDelayed, which according to the documentation:
Causes the Runnable to be added to the message queue, to be run after the specified amount of time elapses. The runnable will be run on the user interface thread.
My questions:
Thanks.
Upvotes: 3
Views: 1341
Reputation: 1006944
Why this method has to be an instance method of View?
It references an mAttachInfo
data member, in its current implementation, and in turn to that data member's mHandler
, which is a Handler
that actually does the postDelayed()
work (if mAttachInfo
is not null
). You are welcome to read all of this in the source code.
Would it be different if I call postDelayed in one view instead of another?
In theory, two View
instances could work with separate Handler
instances. However, from the standpoint of the documented behavior, there should be no difference.
Upvotes: 2