Skip to content Skip to sidebar Skip to footer

Can't Dismiss Popupwindow

i created my popUp window public void myPopUp() { LinearLayout myView = new LinearLayout(getApplicationContext()); pw = new PopupWindow(getApplicationContext

Solution 1:

For dismissing the PopupWIndow but not the root activity or view by backpress is to set the focus. popupWindow.setFocusable(true);

The popup window doesn't have focus so when pressing the back, it closes the main activity as the focus is on the main activity.

Solution 2:

Don't use getApplicationContext() instead pass context or this.

LinearLayout myView = new LinearLayout(context or this);

Post a Comment for "Can't Dismiss Popupwindow"