Close Android popup window with back press

android

Solution

What you need to do is call setBackgroundDrawable on your PopupWindow after you initialize it. Something like:

myPopup.setBackgroundDrawable(new BitmapDrawable());

Problem

I have created a android application where I have created a popup screen. But when I am pressing the back button, popup is not getting closed. I have tried with onBackPressed(). It is not working. Can someone tell me what to do. Regards, Shankar

Original source

Related problems