PopupWindow $BadTokenException: Unable to add window — token null is not valid

后端 未结 11 2204

I have the following error when showing a PopupWindow. The errors are triggered by the line:

checkInPopup.showAtLocation((ViewGroup) mapView.getParent(), Gra         


        
11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 05:34

    A popup's parent can't itself be a popup. Both of their parents must be the same. So, if you create a popup inside a popup, you must save the parent's popup and make it a parent.

    here's an example

提交回复
热议问题