问题
The Progress Dialog is deprecated now for android O. What is the solution for this?
I am getting below warnings . In My project
Warning:(6, 20) 'Progress Dialog' is deprecated. Deprecated in Java
Warning:(72, 43) 'Progress Dialog' is deprecated. Deprecated in Java
Warning:(89, 27) 'Progress Dialog' is deprecated. Deprecated in Java
I didn't find solution for the same problem.
回答1:
According to google:
This class was deprecated in API level 26. ProgressDialog is a modal dialog, which prevents the user from interacting with the app. Instead of using this class, you should use a progress indicator like ProgressBar, which can be embedded in your app's UI. Alternatively, you can use a notification to inform the user of the task's progress.
https://developer.android.com/reference/android/app/ProgressDialog.html
回答2:
Custom ProgressBar is the answer. You can write your own or use something like DelayedProgressDialog from https://github.com/Q115/DelayedProgressDialog
Usage:
DelayedProgressDialog progressDialog = new DelayedProgressDialog();
progressDialog.show(getSupportFragmentManager(), "tag");
来源:https://stackoverflow.com/questions/45859955/progressdialog-is-now-deprecated