Nav
Nav

Reputation: 10422

what is the main purpose of post() method of View

what is the main purpose of the post method which are associated with views such as imageview,textview etc.

new View(Context).post(runnable)

An example will be appreciated :)

Upvotes: 2

Views: 1221

Answers (1)

idiottiger
idiottiger

Reputation: 5177

from the api document:

Causes the Runnable to be added to the message queue. The runnable will be run on the user interface thread. This method can be invoked from outside of the UI thread only when this View is attached to a window.

it look likes: if you want to update the view in another thread, you can simple using post method to update the view. Although the type is runnable, but it can't run in a separated thread, it will run in the ui thread just like invoke a normal method.

Upvotes: 2

Related Questions