How to make blink image when click button

Here is the simple way to make blinking image when click button:

public class BlinkImage extends Activity {
private Button btnClick;
private ImageView imgBlink;
protected void onCreate(Bundle savedInstanceState) {
btnClick.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub

protected void blinkblinkImage() {

Animation animation = new AlphaAnimation(1, 0); // Change alpha
    // from fully
    // visible to
    // invisible
    animation.setDuration(500); // duration - half a second
    animation.setInterpolator(new LinearInterpolator()); // do not alter
    // animation
    // rate
    animation.setRepeatCount(Animation.INFINITE); // Repeat animation
    // infinitely
    animation.setRepeatMode(Animation.REVERSE); // Reverse animation at



Sample outputs:

Happy Coding!!!
How to make blink image when click button How to make blink image when click button Reviewed by D Kshetri on 2:19 AM Rating: 5

No comments:

Powered by Blogger.