Progress Dialog Deprecated, Alternative is SpotsDialog Example

Contact Us Home Disclaimer Tutorials Privacy Policy Tips and Tricks Apps Courses HOME → TUTORIALS Progress Dialog

Views 59 Downloads 0 File size 287KB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

Contact Us Home

Disclaimer Tutorials

Privacy Policy

Tips and Tricks

Apps

Courses

HOME → TUTORIALS

Progress Dialog deprecated, Alternative is SpotsDialog Example in Android Sama Gyani — September 10, 2017 in Tutorials • add comment

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

Search …

Search

GET MORE STUFF Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Enter your email here

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.

SIGN UP NOW we respect your privacy and take protecting it seriously

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. 1 compile 'com.github.d-max:spots-dialog:0.7@aar'

This SpotsDialog is inherited from Alert Dialog, so initially, we create a variable of AlertDialog as class instance. 1 AlertDialog dialog; 2 private static final int DIALOG_SHOW_TIME = 5000;

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 1 dialog = new SpotsDialog(this);

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

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

The complete java file for this example will like below

FOLLOW US ON

Follow my blog with Bloglovin

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

import android.app.AlertDialog; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity;   import dmax.dialog.SpotsDialog;   public class MainActivity extends AppCompatActivity {       AlertDialog dialog;     private static final int DIALOG_SHOW_TIME = 5000;       @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);           dialog = new SpotsDialog(this);         dialog.show();           new Handler().postDelayed(new Runnable() {             @Override             public void run() {                 dialog.dismiss();             }         },DIALOG_SHOW_TIME);       } }

To style this spots dialog, we can define a custom style in the styles.xml file and pass it to the Spots Dialog constructor. 1 2 3 4 5 6 7 8

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. 1 dialog = new SpotsDialog(this,R.style.Custom);

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.

progress dialog alternative, spots dialog in android example

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

This content is locked! Please support us, use one of the buttons below to unlock the content.



like Like 4



Tweet tweet

error+ 

android development progress dialog alternative progress dialog alternative example in android progress dialog alternative spots dialog

You May Also Like

Force Update Android App When New Version Available Example

Android Rate Us Dialog Example

Custom Font in Android Example in Android Studio

Create Material Design Icon for Android App in Android Studio

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 * Comment

Name *

Email *

Website

Post Comment

© 2018 DroidBlogger - Android Tutorials and Tricks - Theme by HappyThemes

Home

Tutorials

Tips and Tricks

Apps

Courses