0

PopupWindow shows and works perfectly in AVD but not on a real device.

This is the function that is supposed to create the popup:
http://pastebin.com/jabHVp2c

What I tried:
I made sure that onClick is being called, and it is.
I made sure no other View in the hierarchy is clipping, or even clickable, just in case.
The problem seems to have appeared after I added animations to the popup, but commenting them out makes no difference, and as mentioned, it does work in the emulator as expected.

App API level is 15, AVD API level is 23, device is LG G3 running API 23.

Max Izrin
  • 938
  • 1
  • 11
  • 17
  • Removed any trace of animations including the XML files, no go. Also added debugging lines and the function is getting executed to the end, but popup just isn't showing. – Max Izrin Jan 25 '16 at 11:39

2 Answers2

0
popupWindow.setWindowLayoutMode(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
popupWindow.showAtLocation(rootView, Gravity.CENTER, 0, 0);
popupWindow.update();

This solves the problem. Apparently the "update()" is required, though it works without it on the emulator, and I have no idea how it worked on the device several version before.

Hope this helps someone.

Max Izrin
  • 938
  • 1
  • 11
  • 17
0

I think @Max answer is absolutely correct but popupWindow.update(); is not required, instead popupwindow.showAtLocation() works fine.

Naman
  • 27,789
  • 26
  • 218
  • 353
Bhavinkumar Patel
  • 515
  • 1
  • 12
  • 28
  • It used to work without it, and then for some reason, whatever I changed made it not work anymore, and only on a real device. I'm still don't know what went wrong. – Max Izrin Jan 26 '16 at 13:22