ProgressDialog is now deprecated [duplicate]

℡╲_俬逩灬. 提交于 2019-12-08 01:57:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!