VOOZH about

URL: https://www.geeksforgeeks.org/android/how-to-add-particlesmasher-in-android-app/

⇱ How to Add ParticleSmasher in Android App? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Add ParticleSmasher in Android App?

Last Updated : 23 Jul, 2025

ParticleSmasher is an Android library that allows us to easily particle effect to our views in our android app .we can use this feature in many apps such as the app in which we destroy a particular UI after completion of the task or when we delete a particular file. 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. 

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: Before going to the coding section first do some pre-task

Go to app -> res -> values -> colors.xml file and set the colors for the app.


Go to Gradle Scripts -> build.gradle (Module: app) section and import the following dependencies and click the “sync Now” on the above pop-up.

implementation 'com.ifadai:particlesmasher:1.0.1'

Step 3: Designing the UI

In the activity_main.xml remove the default Text View and change the layout to Relative layout and inside it add a vertical LinearLayout and inside the LinearLayout add 6 buttons with different ids, text, and colors. Below is the code for the activity_main.xml file. 


Step 4: Coding Part

Open the MainActivity.java file and inside the onCreate() method create and initialize ParticleSmasher object and do the same for 6 buttons as shown below.  


Below is the code which is used to smash the view (It  also has OnAnimatorListener when animation start and end, we simply show toast message inside the methods ), we will call this view inside the onClick Listeners of different buttons  


Next, create an individual OnClickListener for all the 6 Button's, and inside the onClick (View view) method add the above code with different effects. 


Below is the complete code for the MainActivity.java file. Comments are added inside the code to understand the code in more detail 


Output: 


Comment
Article Tags:

Explore