I am writing an app, where one of my views need to blink by the use of a timer constantly, but I have trouble with making it blink.
Here's my handler code
@SuppressWarnings("All")
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
try {
circle.setVisibility(View.VISIBLE);
Thread.sleep(100);
circle.setVisibility(View.INVISIBLE);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
So i am sending an empty message to the handler with some INTERVAL
constantly, and I want the image to get visible for 100 milliseconds and then hide again. But the problem is, until the method is finished, my UI elements won't get refreshed. How I do this?
Thanks in advance.
then send message 1 & 2 somewhere.