init and create Progress Dialog - Android android.app

Android examples for android.app:ProgressDialog

Description

init and create Progress Dialog

Demo Code

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 ww.j  ava2  s  . c om*/
    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