Close popup problem on button click
<p>I create info_popup.xml ( simple, I have textview and imagebutton on popup). I show in my main activity, but I don't know how to close that popup on click on btnExitInfo button. What to put in click listener to close pw ? I tried with GONE but it doesn't work, it is still there .</p>

<pre><code> LayoutInflater inflater = (LayoutInflater) currentActivity
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.info_popup,
                    null, false), 230, 230, true);

            pw.showAtLocation(currentActivity.findViewById(R.id.main),
                    Gravity.CENTER, 0, 0);
            final View popupView=inflater.inflate(R.layout.info_popup, null, false);

            ImageButton btnExitInfo=(ImageButton)popupView.findViewById(R.id.btnExitInfo);
            btnExitInfo.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    //popupView.setVisibility(View.GONE);


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