how to dismiss popupWindow?
<p>I have a <code>PopupWindow</code> on my activity. However, <code>PopupWindow</code> is not dismissed after interacting with my activity.</p>

<p>I want to dismiss the popup when I'm touching/scrolling/clicking/etc on the screen which is not the <code>PopupWindow</code>.</p>

<pre><code>public class ListViewForDeleteContact extends AppCompatActivity {
    ListView myListView;
    protected  void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listviewfordeletecontactlayout_main);

        myListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                LayoutInflater layoutInflater=(LayoutInflater)ListViewForDeleteContact.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                View dfg= layoutInflater.inflate(R.layout.popupwindowfordeletelayout_main,(ViewGroup)findViewById(R.id.popupId));
                PopupWindow popupWindow=new PopupWindow(dfg,420,300,true);

                popupWindow.showAtLocation(dfg, Gravity.CENTER, 0, 0);
                popupWindow.setOutsideTouchable(true);

            }
        });
    }
}
</code></pre>

<p>I tried some methods like <code>setOutsideTouchable(true);</code> and <code>setBackgroundDrawable(true)</code> but it did not work for me.</p>