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);
精彩评论