Java tutorial
//package com.java2s; import android.app.ProgressDialog; import android.content.Context; public class Main { private static ProgressDialog mProgressDialog; public static void showSimpleProgressDialog(Context context, String title, String msg, boolean isCancelable) { try { if (mProgressDialog == null) { mProgressDialog = ProgressDialog.show(context, title, msg); mProgressDialog.setCancelable(isCancelable); } if (!mProgressDialog.isShowing()) { mProgressDialog.show(); } } catch (IllegalArgumentException ie) { ie.printStackTrace(); } catch (RuntimeException re) { re.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } public static void showSimpleProgressDialog(Context context) { showSimpleProgressDialog(context, null, "Loading...", false); } }