Android Spinner Exception when clicked BadTokenException

和自甴很熟 提交于 2019-12-05 21:27:15

There is a context conflict. Try adding this in your XML spinner declaration : android:spinnerMode="dialog"

Do a test here,

Remove temporarily this part of your code

 this.setTouchInterceptor(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    PopupDialog.this.dismiss();

                    return true;
                }

                return false;
            }
        });

and check.

Joohay

I hope it is not too late. I had the same issue. Things were working fine with

android:spinnerMode="dialog"

However, I was unable to achieve a dropdown (without dialog popup) with the PopupWindow. I got the same working by using alertbuilder instead.

You can follow this tutorial: YT Link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!