Show and Hide progress dialog in Android

/** * This function is used to show a progress dialog * * @param mcontext * -context of the activity */ public static void showDialog(Context mContext, String strMessage) { try { if (pgdialog != null) if (pgdialog.isShowing()) pgdialog.dismiss(); pgdialog = ProgressDialog.show(mContext, "", strMessage, true); } catch (Exception e) { e.printStackTrace(); } } /** * This function is used to dismiss the dialog * * @param pgDialog */ public static void dismissDialog() { try { if (pgdialog.isShowing()) pgdialog.dismiss(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.