I have same problem. I have PopupWindow with button (R.id.imageView1). I have callback on that button. I deregister callback when popup is disimissed (popupWindow.setOnDismissListener).
What is strange, warning message does not occur in debug mode.
PopupWindow popupWindow;
@Override
public void onCreate(Bundle savedInstanceState) {
//layout for popup window
LayoutInflater layoutInflater= (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.grid, null);
popupWindow = new PopupWindow(
popupView,
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
public void showPopup(View view) {
final View popupView=popupWindow.getContentView();
popupView.findViewById(R.id.imageView1).setOnClickListener(new PopupOnClickListener(popupWindow,this));
//required if I want popup to close on click outside popup area
popupWindow.setOutsideTouchable(true);
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.showAsDropDown(view, 50, -30);
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
popupView.findViewById(R.id.imageView1).setOnClickListener(null);
}
});
}