Open In App

Explode Animation in Android

Last Updated : 21 Apr, 2021
Like Article

In this article, we are going to show the android explode animation. This is something that is very interesting. You may have seen this feature in some game apps or even many money transfer apps. They show rewards like this. When you click on the reward it will explode and will show the reward that you have got. A sample GIF is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Java language. 

Explode Animation in Android Sample GIF

Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.

Step 2: Working with the build.gradle file

Navigate to the Gradle Scripts > build.gradle(Module:app) and add the below dependency in the dependencies section.   

implementation 'tyrantgit:explosionfield:1.0.1'

Step 3: Working with the activity_main.xml file

Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file. We will create a simple ImageView which we will be exploding on click.


<?xml version="1.0" encoding="utf-8"?>

Step 4: Working with the file

Go to the file and refer to the following code. Below is the code for the file. Comments are added inside the code to understand the code in more detail.


import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import tyrantgit.explosionfield.ExplosionField;
public class MainActivity extends AppCompatActivity {
    boolean explod = true;
    protected void onCreate(Bundle savedInstanceState) {
        final ImageView explode = findViewById(;
        final ExplosionField explosionField = ExplosionField.attach2Window(this);
        explode.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // as we click on the image it will explode
                if (explod) {
                    explod = false;


Article Tags :
Practice Tags :