title: Why custom dialog is not working on API 23?
body: <p>I am facing one issue on custom dialog box on API 23, it's crashing.</p>
  
  <pre><code>final Dialog dialog = new Dialog(getActivity());
  dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
  dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
  dialog.setContentView(R.layout.progress_dialog);
  dialog.setCancelable(false);
  dialog.show();
  </code></pre>
  
  <p>Crash Report:</p>
  
  <pre><code>android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@3387043 -- permission denied for this window type
  at android.view.ViewRootImpl.setView(ViewRootImpl.java:598)
  at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:310)
  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:86)
  at android.app.Dialog.show(Dialog.java:319)
  at com.example.hello.fragment.ExploreFragment.exploreBeers(ExploreFragment.java:255)
  at com.example.hello.fragment.ExploreFragment$4.onEditorAction(ExploreFragment.java:203)
  at android.widget.TextView.onEditorAction(TextView.java:4773)
  at com.android.internal.widget.EditableInputConnection.performEditorAction(EditableInputConnection.java:139)
  at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:304)
  at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:152)
  at android.app.ActivityThread.main(ActivityThread.java:5497)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  </code></pre>
  
  <p>Manifest Permission:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /&gt;
  </code></pre>
  
  <p>It's not at all working i am little confuse, please kindly go through my post and suggest me some solution.</p>