how to dismiss a pop up window?
<pre><code>private void newGame() {


        LayoutInflater inflater = (LayoutInflater) this
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        final PopupWindow pw = new PopupWindow(inflater.inflate(
                R.layout.settings, null, true), 300, 600, true);

        pw.showAtLocation(this.findViewById(R.id.settings), Gravity.RIGHT, 0, 0);

        pw.setTouchInterceptor(new OnTouchListener() {

            public boolean onTouch(View v, MotionEvent event) {
                // your code when touched on the event


                return false;
            }

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

<p>I have posted my code here.I am getting the pop up window.but i dont know how to add events to that pop up window and make it invisible after clicking it.</p>
