Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create loading dialogs in Android?

Those dark spinning progress dialogs in the Amazon and Engadget apps - are those standard in Android?

like image 749
Eno Avatar asked Mar 26 '10 18:03

Eno


People also ask

How do you make progress dialog?

ProgressDialog dialog = new ProgressDialog(MainActivity. this); dialog. setMessage("Your message.."); dialog. show();

What is progress dialog in android?

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.

Which class is used to create dialogs for an android app?

The Dialog class is the base class for dialogs, but you should avoid instantiating Dialog directly. Instead, use one of the following subclasses: AlertDialog. A dialog that can show a title, up to three buttons, a list of selectable items, or a custom layout.


2 Answers

It's a ProgressDialog, with setIndeterminate(true).

From http://developer.android.com/guide/topics/ui/dialogs.html#ProgressDialog

ProgressDialog dialog = ProgressDialog.show(MyActivity.this, "",                      "Loading. Please wait...", true); 

An indeterminate progress bar doesn't actually show a bar, it shows a spinning activity circle thing. I'm sure you know what I mean :)

like image 152
synic Avatar answered Oct 01 '22 13:10

synic


Today things have changed a little.

Now we avoid use ProgressDialog to show spinning progress:

enter image description here

If you want to put in your app a spinning progress you should use an Activity indicators:

http://developer.android.com/design/building-blocks/progress.html#activity


Update

Thay have renamed the component to Progress Indicators now.

The new link for reference is: https://material.io/components/progress-indicators/android

like image 24
Rafael Miceli Avatar answered Oct 01 '22 13:10

Rafael Miceli