Progress Dialog deprecated, Alternative is SpotsDialog Example in Android

Progress Dialog deprecated in Android Oreo 8 i.e., SDK 26. Now it’s time to find some alternative to the progress dialog. After some google search, I found this simple progress dialog called SpotsDialog from wasabeef android ui library.

Similar to progress dialog,  we need not define an xml widget for SpotDialog. SpotsDialog is clean and gives fluid user experience.

In short, we can expect this an alternative to progress dialog in android.

We implemented this in our project, here we will example on how to implement this progress dialog alternative.

Let us start the implementation.

In app level build.gradle, place the Spots Dialog library and sync the project.

This SpotsDialog is inherited from Alert Dialog, so initially, we create a variable of AlertDialog as class instance.

We have also declared an int variable to show the spots dialog for that duration of time.

In onCreate() method, we declare spots dialog as follows

To show the dialog, we should use show() method.

To dismiss the dialog, we should use dismiss() method.

The complete java file for this example will like below

To style this spots dialog, we can define a custom style in the styles.xml file and pass it to the Spots Dialog constructor.

We can put custom title, spot color, and spot count for spots dialog.

Pass the style name to the Spots Dialog constructor to see the effect.

We do not need to define anything in layout, leave it as it is, build the project and run the app to see the output.

This is all about Spots Dialog, we can use this as an alternative to progress dialog, which is deprecated now in SDK 26.

Download this project

You May Also Like

About the Author: Sama Gyani

I am Computer Science Graduate. I turn my interests into posts here.

Leave a Reply

Your email address will not be published. Required fields are marked *