show Progress Dialog - Android User Interface

Android examples for User Interface:ProgressDialog

Description

show Progress Dialog

Demo Code


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

import java.util.concurrent.atomic.AtomicInteger;

public class Main {
    private static ProgressDialog dialog;
    private static AtomicInteger countStartDialog = new AtomicInteger(0);

    public static void showProgressDialog(Context context,
            final String title, final String msg) {
        countStartDialog.incrementAndGet();
        if (context != null && (dialog == null || !dialog.isShowing())) {
            dialog = new ProgressDialog(context);
            dialog.setTitle(title);/*from w  w  w . jav  a  2 s .  com*/
            dialog.setIndeterminate(true);
            dialog.setCancelable(false);
            dialog.setMessage(msg);
            dialog.show();
        }
    }
}

Related Tutorials