Create ProgressDialog from message and if indeterminate - Android User Interface

Android examples for User Interface:ProgressDialog

Description

Create ProgressDialog from message and if indeterminate

Demo Code


//package com.java2s;
import android.app.ProgressDialog;
import android.content.Context;

public class Main {
    /**//w  ww .  j  ava  2s. c  om
     * get ProgressDialog
     * 
     * @param context
     *            a {@link android.content.Context} object.
     * @param startMsg
     *            a {@link java.lang.String} object.
     * @param indeterminate
     *            a boolean.
     * @return a {@link android.app.ProgressDialog} object.
     */
    public static ProgressDialog getProgressDialog(Context context,
            String startMsg, boolean indeterminate) {
        ProgressDialog progressDialog = new ProgressDialog(context);
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDialog.setCancelable(indeterminate);
        // mProgressDialog.setMax(100);
        progressDialog.setMessage(startMsg);
        return progressDialog;
        // mProgressDialog.show();
    }
}

Related Tutorials