Create and init ProgressDialog - Android User Interface

Android examples for User Interface:ProgressDialog

Description

Create and init ProgressDialog

Demo Code


//package com.java2s;

import android.app.ProgressDialog;

import android.content.Context;

public class Main {

    public static ProgressDialog initProgressDialog(Context context,
            int resid) {
        String message = context.getResources().getString(resid);
        return initProgressDialog(context, message);
    }/*w w  w .  j  av a 2 s . c  o m*/

    public static ProgressDialog initProgressDialog(Context context,
            String message) {
        ProgressDialog progressDialog = new ProgressDialog(context);
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDialog.setMessage(message);
        progressDialog.setCancelable(true);
        progressDialog.show();
        return progressDialog;
    }
}

Related Tutorials