简体   繁体   中英

Unable to display progress dialog in android

I am trying to show progress dialog but it's not showing on my mobile screen.

final ProgressDialog progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("Checking Meter Status....");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setIndeterminate(true);
progressDialog.setCancelable(false);
progressDialog.show();

Any help would be highly appreciated?

In the android developer documentation for dialogs ,

Caution: Android includes another dialog class called ProgressDialog that shows a dialog with a progress bar. This widget is deprecated because it prevents users from interacting with the app while progress is being displayed. If you need to indicate loading or indeterminate progress, you should follow the design guidelines for Progress & Activity and use a ProgressBar in your layout, instead of using ProgressDialog .

As a matter of fact it is always recommended to follow guidelines issued in the developer documentation, so you should also do the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM