FileDocCategorySizeDatePackage
ProgressBar3.javaAPI DocAndroid 1.5 API2690Wed May 06 22:41:08 BST 2009com.example.android.apis.view

ProgressBar3

public class ProgressBar3 extends android.app.Activity
Demonstrates the use of progress dialogs. Uses {@link Activity#onCreateDialog} and {@link Activity#showDialog} to ensure the dialogs will be properly saved and restored.

Fields Summary
android.app.ProgressDialog
mDialog1
android.app.ProgressDialog
mDialog2
private static final int
DIALOG1_KEY
private static final int
DIALOG2_KEY
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle savedInstanceState)



    
        
        super.onCreate(savedInstanceState);

        setContentView(R.layout.progressbar_3);

        Button button = (Button) findViewById(R.id.showIndeterminate);
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                showDialog(DIALOG1_KEY);
            }
        });

        button = (Button) findViewById(R.id.showIndeterminateNoTitle);
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                showDialog(DIALOG2_KEY);
            }
        });
    
protected android.app.DialogonCreateDialog(int id)

        switch (id) {
            case DIALOG1_KEY: {
                ProgressDialog dialog = new ProgressDialog(this);
                dialog.setTitle("Indeterminate");
                dialog.setMessage("Please wait while loading...");
                dialog.setIndeterminate(true);
                dialog.setCancelable(true);
                return dialog;
            }
            case DIALOG2_KEY: {
                ProgressDialog dialog = new ProgressDialog(this);
                dialog.setMessage("Please wait while loading...");
                dialog.setIndeterminate(true);
                dialog.setCancelable(true);
                return dialog;
            }
        }
        return null;