开发者

Android Java countdown and then do somethign [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_如何转开发 Closed 11 years ago.

How can i countdown to like 5 then something will happen?

Ex: Activity Starts it counts down to 5 then a toast comes up


This you can perform by using CountdownTimer in-build abstract class

 new CountdownTimer(5000, 1000) {

     public void onTick(long millisUntilFinished) {
         mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
     }

     public void onFinish() {
        // Now countdown is finished, perform whatever you want
         mTextField.setText("done!");
     }
  }.start();


Please use Timer class

See this link for reference

http://developer.android.com/resources/articles/timed-ui-updates.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜