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

后端 未结 11 2183

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:40

    Same problem happened with me when i try to show popup menu in activity i also got same excpetion but i encounter problem n resolve by providing context

    YourActivityName.this instead of getApplicationContext() at

    Dialog dialog = new Dialog(getApplicationContext());

    and yes it worked for me may it will help someone else

提交回复
热议问题