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

后端 未结 11 2182

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

    Try to use it

    LayoutInflater inflater = (LayoutInflater).getApplicationContext().getSystemService(LAYOUT_INFLATER_SERVICE);
    View view = inflate.from(YourActivity.this).inflate(R.layout.yourLayout, null);
    

提交回复
热议问题