Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • But this thing ll run this code after specific time just for once. I want it to run my code every 5 seconds till i say stop. So can i use for loop for this?
    – g33k
    Commented Nov 4, 2016 at 6:33
  • Well then you can add logic to the Runnable to loop. Something like if (!conditionMet()) handler.postDelayed(....). You will, of course have to make the Handler final to access it from within the Runnable Commented Nov 4, 2016 at 6:44