---
title: "how to implement blink effect on the image transition between android activites"  
description: "how to implement blink effect on the image transition between android activites"  
author: "David Miller"  
published: 2015-11-29  
updated: 2023-07-02  
canonical: https://www.mindstick.com/forum/33657/how-to-implement-blink-effect-on-the-image-transition-between-android-activites  
category: "android"  
tags: ["android", "android styles", "android activity", "android controls"]  
reading_time: 2 minutes  

---

# how to implement blink effect on the image transition between android activites

I am working on image [transition effect](https://www.mindstick.com/forum/158742/how-can-you-create-a-smooth-transition-effect-between-css-property-changes) while two activities using the new [shared](https://www.mindstick.com/forum/155587/what-is-shared-assembly) [elements](https://www.mindstick.com/forum/1440/wpf-button-with-multiple-text-elements) from lollipop OS. It's working but I get a distorted white blinking on the screen during the transition and I can't find how to implement a solution for this issue. After doing lots of R&[amp](https://www.mindstick.com/forum/156207/what-is-amp);D, i found Same kind of issue here :[http://stackoverflow.com/questions/28364106/blinking-screen-on-image-transition-between-activities](http://stackoverflow.com/questions/28364106/blinking-screen-on-image-transition-between-activities) \
\
\
Please help me. thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams) !!

## Replies

### Reply by Aryan Kumar

To implement a blink [effect](https://yourviews.mindstick.com/view/81363/coronavirus-effect-on-american-farms-is-severe) on the image transition between Android activities, you can use the following code:

Code snippet

```plaintext
public class MainActivity extends AppCompatActivity {

    private ImageView imageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        imageView = findViewById(R.id.imageView);

        // Get the image from the first activity
        Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.image);

        // Create a Transition object
        Transition transition = new Transition();

        // Set the transition duration
        transition.setDuration(1000);

        // Set the transition effect
        transition.setInterpolator(new AccelerateDecelerateInterpolator());

        // Set the transition image
        transition.addTarget(imageView);

        // Start the transition
        transition.start();

        // Start the second activity
        Intent intent = new Intent(this, SecondActivity.class);
        startActivity(intent);
    }
}
```

This code will first get the image from the first activity. Then, it will create a `Transition` object and set its duration and interpolator. Next, it will set the `Transition` object's image to the `imageView`. Finally, it will start the `Transition` object and start the second activity.

The `Transition` object will cause the `imageView` to blink for 1000 milliseconds before starting the second activity.

To use this code, you need to add the following dependency to your project's `build.gradle` file:

Code snippet

```plaintext
dependencies {
    ...
    implementation 'androidx.transition:transition:1.4.1'
}
```

You also need to add the following code to your project's `activity_main.xml` file:

Code snippet

```plaintext
<ImageView
    android:id="@+id/imageView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerCrop" />
```

This code will add an `ImageView` widget to the `activity_main.xml` file. The `ImageView` widget will be used to display the image that is being blinked.


---

Original Source: https://www.mindstick.com/forum/33657/how-to-implement-blink-effect-on-the-image-transition-between-android-activites

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
