title: How to Dialogfragment disable click outside on android?
body: <p>I use <code>extends DialogFragment</code></p>
  
  <p>I want except dialog, disable click on android.</p>
  
  <p>I try <code>setCanceledOnTouchOutside(true)</code> but it doesn't not work.</p>
  
  <p>and please check my source.</p>
  
  <pre><code>public class QuestDialog extends DialogFragment {
     private String mainMessage = "";
     private View.OnClickListener positiveListener = null;
     private View.OnClickListener negativeListener = null;
  
   @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
     View view = inflater.inflate(R.layout.main_dialog, container, false);
  
     TextView textView = (TextView) view.findViewById(R.id.main_msg);
     textView.setText(mainMessage);
  
     Button positiveBtn = (Button) view.findViewById(R.id.dialog_positive_btn);
     Button negativeBtn = (Button) view.findViewById(R.id.dialog_negative_btn);
  
     positiveBtn.setOnClickListener(new View.OnClickListener() {
         @Override 
         public void onClick(View v) {
            dismiss();
            if (positiveListener != null) { 
                positiveListener.onClick(view);
            }
         }
     });
     negativeBtn.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {
            dismiss();
  
            if (negativeListener != null) [
                negativeListener.onClick(view);
            }
         }
      });
      return view;
    }
  
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
  
      Dialog dialog = super.onCreateDialog(savedInstanceState);
      dialog.setCanceledOnTouchOutside(true);
      dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
  
      dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
              WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
      dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM |
              WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  
      dialog.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
              | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
              | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
              | View.SYSTEM_UI_FLAG_FULLSCREEN
              | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
              | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
      return dialog;
   }
   public void setMessage(final String msg) {
       mainMessage = new String(msg);
   }
  
   public void setPositiveButton(View.OnClickListener listener) {
       positiveListener = listener;
   }
  </code></pre>
  
  <p>this one.</p>
  
  <p>How to disable click of dialogfragment outside on android?</p>
  
  <p>thanks.</p>