Programmer Question
Hi,
I have a button and I want to highlight it for a brief time. For e.g. it's a red button and it should be orange for a second and then turn red again.
My code for this looks like the following:
button.setBackgroundResource(R.color.orange); //highlight value
button.invalidate();
try {
Thread.sleep(3000);
} catch (InterruptedException e1) {
}
button.setBackgroundResource(R.color.red); //old value
button.invalidate();
This doesn't work. The current thread pauses for 3 seconds, but the background image is not changed before. In fact it only changes afterwards to the "old value".
How can i build this highlight feature?
Find the answer here
No comments:
Post a Comment