开发者

How to set a timeout for a simple instruction?

I want to set my textview to have a string, then, after some seconds i w开发者_如何学Cant to set another string to it. Is it possible with Android? Thank you very much. This is what i want to do:

wtActivity2.updateStatus("Call rejected");
//timeout 5 seconds
wtActivity2.updateStatus("Ready.");


Pretty simple, actually:

final TextView textView = (TextView)findViewById(R.id.status);
textView.setText("Call rejected");
textView.postDelayed(new Runnable() {
    public void run() {
        textView.setText("Ready.");
    }
}, 5000);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜