Guys i have a textview which i need it to be blinking please help me with it.
Courtesy to the top answer, this is what i did:
textBlink = new TimerTask() {
int countdown = 10;
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (countdown <= 0) {
timer.cancel();
textview.setVisibility(View.GONE);
} else {
textview.setVisibility(textview.getVisibility() == View.VISIBLE?View.GONE:View.VISIBLE);
countdown--;
}
}
});
}
};
then somewhere on the code:
timer = new Timer();
timer.scheduleAtFixedRate(textBlink,0,500);
This will do a blink effect for 5 seconds. Recommended for if you don't want the fadeIn-fadeOut effect.