Professional Documents
Culture Documents
Progress Dialog Deprecated, Alternative Is SpotsDialog Example
Progress Dialog Deprecated, Alternative Is SpotsDialog Example
Progress Dialog deprecated in Android Oreo 8 i.e., SDK 26. Now it’s time to find some alternative to
Enter your email here
the progress dialog. After some google search, I found this simple progress dialog called SpotsDialog
from wasabeef android ui library.
SIGN UP NOW
Similar to progress dialog, we need not define an xml widget for SpotDialog. SpotsDialog is clean and
we respect your privacy and take protecting it
gives fluid user experience.
seriously
FOLLOW US ON
We implemented this in our project, here we will example on how to implement this progress dialog
alternative. Follow my blog with Bloglovin
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.
1 dialog.show();
1 dialog.dismiss();
The complete java file for this example will like below
1 import android.app.AlertDialog;
2 import android.os.Bundle;
3 import android.os.Handler;
4 import android.support.v7.app.AppCompatActivity;
5
6 import dmax.dialog.SpotsDialog;
7
8 public class MainActivity extends AppCompatActivity {
9
10 AlertDialog dialog;
11 private static final int DIALOG_SHOW_TIME = 5000;
12
13 @Override
14 protected void onCreate(Bundle savedInstanceState) {
15 super.onCreate(savedInstanceState);
16 setContentView(R.layout.activity_main);
17
18 dialog = new SpotsDialog(this);
19 dialog.show();
20
21 new Handler().postDelayed(new Runnable() {
22 @Override
23 public void run() {
24 dialog.dismiss();
25 }
26 },DIALOG_SHOW_TIME);
27
28 }
29 }
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
like
Like 4 tweet
Tweet error+
android development progress dialog alternative progress dialog alternative example in android
progress dialog alternative spots dialog
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment
Post Comment
© 2018 DroidBlogger - Android Tutorials and Tricks - Theme by HappyThemes Home Tutorials Tips and Tricks Apps Courses