Question

I followed @CommonsWare answer(How to get a callback when a Spinner popup dialog is dismissed?) to implement a callback when the spinner popup is closed.

When I select an item everything works, but when I click outside of the bounds of the spinner I get this warning on logcat: Attempted to finish an input event but the input event receiver has already been disposed.

I already tried registering the OnTouchListener too, but nothing is called when I click outside.

Someone can tell me what this warning means? I already googled that but didn't find nothing.

Was it helpful?

Solution

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);
                }
            });
        }

OTHER TIPS

I had this problem earlier and it seemed that I was closing my onCreate() method too soon.

Check your code very carefully!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top