 <p>Try like this :</p> <pre><code> progressDialog = new ProgressDialog(getActivity()); </code></pre> <p>And if you wish to customize your dialog and put self created Layout in it.</p> <pre><code>/** * Created by vivek on 18/10/16. */ public class CustomDialog { private static Dialog dialog; private static Context context; public CustomDialog(Context context) { this.context = context; } /** * Comman progress dialog ... initiates with this * * @param message * @param title */ public static void showProgressDialog(Context context, String title, String message) { if (dialog == null) { dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.custom_loader); dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); dialog.show(); } } public static boolean isProgressDialogRunning() { if (dialog != null &amp;&amp; dialog.isShowing()) { return true; } else return false; } /** * Dismiss comman progress dialog */ public static void dismissProgressDialog() { if (dialog != null &amp;&amp; dialog.isShowing()) { dialog.dismiss(); dialog = null; } } } // End of main class over here ... </code></pre>