title: Detect clicks outside of a View
body: <p>I have a view declared as such:</p>
  
  <pre><code>LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  myView = layoutInflater.inflate(R.layout.background, null);
  </code></pre>
  
  <p>I want to detect clicks outside of myView, how can I do this?</p>
  
  <p>So this background.xml is a small relativelayout that pops up when the user clicks on a button. It has an edit text so I do this to gain focus to it and allow to type on it:</p>
  
  <pre><code>response.setFocusable(true);
  params.flags = params.flags &amp; ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
  mWindowManager.updateViewLayout(myView, params);
  </code></pre>
  
  <p>Now if the user clicks outside this pop up(background.xml aka myView) I want to set the param.flags back to FLAG.NOT_FOCUSABLE</p>