Error: WebView.destroy() called while still attached

后端 未结 5 560
一向
一向 2020-12-23 11:50

I am getting this error when the device changes orientation:

Error: WebView.destroy() called while still attached

With this code:



        
5条回答
  •  盖世英雄少女心
    2020-12-23 12:15

    To avoid the error you just need to remove all views before you destroy the ad.

    @Override
    public void onDestroy()
    {
        if (adView != null)
        {
            adView.removeAllViews();
            adView.destroy();
        }
        super.onDestroy();
    }
    

提交回复
热议问题