Rezaul
Rezaul

Reputation: 620

How to set an action when I click outside of the popup window?

I want to set an action or do something like change button background when click outside of the PopupWindow.

Here marked default button color:- enter image description here

Here marked changed button color after click:- enter image description here

After clicking outside of the PopupWindow, I want to change my button background to default.

How can i do that? I need some help.

Upvotes: 2

Views: 426

Answers (1)

Kane O'Riley
Kane O'Riley

Reputation: 2528

Use an OnDismissListener for your PopupWindow:

    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            // Change the icon
        }
    });

Where popupWindow is the PopupWindow you are displaying.

Upvotes: 1

Related Questions