使用 PopupWindow 的时候遇到Activity com.avcit… has leaked
在OnCreate方法中调用 popupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, x, y); 时,会出现以下错误: Activity com.avcit.conference.MainActivity has leaked window android.widget.PopupWindow$PopupViewContainer@406dfc10 that was originally added here android.view.WindowLeaked: Activity com.avcit.conference.MainActivity has leaked window android.widget.PopupWindow$PopupViewContainer@406dfc10 that was originally added here 这是因为这个popupWindow依赖的父Activity已经finish()的了,但是它还存在,所以回有上面的提示。 有两种解决办法: (1)在onPause()中将它dismiss()了。 <!-- lang: java --> @Override protected void onPause() { // TODO Auto-generated method