0

I have a Activity and implement PopupWindow class for a apps alert view.
My excepted case is the popupwindow is shown and pressed the device back button that will be called another action.
I tried to implement the onBackPressed in my Activity. But the popupwindow is shown, onBackPressed won't call. When I dismissed the popupwindow, the onBackPressed is called.
So anyone know how can implement the back button method in my case. Thanks.

@Override
public void onBackPressed() {
    super.onBackPressed();
}
Wong Manlok
  • 387
  • 4
  • 17

1 Answers1

1

You should remove popWindow.setFocusable(true) this part.

And set final PopupWindow popWindow = new PopupWindow(inflatedView, size.x, size.y, false); like this.

If you want to see more detail of the answer, you could also check here.

Isaac Lee
  • 466
  • 1
  • 3
  • 15