• Latest Code...

    Featured Post

    Implementing Hilt in a Kotlin Android Jetpack Compose Project with MVVM Architecture

     In modern Android development, maintaining a scalable codebase can be challenging, especially when it comes to dependency management. Hilt,...

    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;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.blink);
    btnClick=(Button)findViewById(R.id.button1);
    imgBlink=(ImageView)findViewById(R.id.imageView1);
    btnClick.setOnClickListener(new View.OnClickListener() {

    @Override
    public void onClick(View v) {
    // TODO Auto-generated method stub
    blinkblinkImage();
    }
    });

    }
    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

        imgBlink.startAnimation(animation);

    }
    }


    Sample outputs:




    Happy Coding!!!

    Contact Form

    Name

    Email *

    Message *