show ProgressDialog - Android android.app

Android examples for android.app:ProgressDialog

Description

show ProgressDialog

Demo Code

import android.app.Activity;
import android.app.ProgressDialog;
import android.widget.Toast;

public class Main{

    public static ProgressDialog showDialog(Activity context,
            String strContent) {/*from w  ww. j ava2  s.  co m*/
        if (context != null) {
            ProgressDialog infoDialog = new ProgressDialog(context);
            infoDialog.setMessage(strContent);
            infoDialog.show();
            return infoDialog;
        }
        return null;
    }
    public static ProgressDialog showDialog(Activity context,
            String strContent, int max) {
        if (context != null) {
            ProgressDialog dialog = new ProgressDialog(context);
            dialog.setMessage(strContent);
            dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            dialog.setMax(max);
            dialog.setProgress(0);
            dialog.show();
            return dialog;
        }
        return null;
    }

}

Related Tutorials