My problem is that I have started an animation when my count is < 3 and when I want to stop it does not.
if (contador >= 3) {
TextView tvcont =(TextView)findViewById(R.id.tvContador);
tvcont.setText(Integer.toString(contador));
tvcont.setTextColor(Color.parseColor("#FF0000"));
}
else {
parpadeopro();
}
the parpadeo pro code -->
private void parpadeopro(){
TextView tvcont =(TextView)findViewById(R.id.tvContador);
tvcont.setText(Integer.toString(contador));
Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50);
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
tvcont.startAnimation(anim);
}
and then I tried to create a new void called stop_parpadeo with that code, but it doesn't stop...
private void stop_parpadeo(){
TextView tvcont =(TextView)findViewById(R.id.tvContador);
tvcont.setText(Integer.toString(contador));
Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50);
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
tvcont.startAnimation(anim);
anim.cancel();
}
Any helps guys? Thanks!.
0 comments:
Post a Comment