I just want to know if there's a way of applying PopupWindow.setWindowLayoutType()
on API < 23. Based on the documentation, it can only be use on API 23 and above. But is there a hack or workaround?
I have a custom toast
. I want this toast
to dismiss/cancel whenever the user tap/click it. But unfortunately, There's no way of interacting to the toast
. I tried setting an onClickListener
but got no luck. So I decided to use PopupWindow
and adding a handler
to dismiss the PopupWindow
after 3sec. Everything is fine except that when navigating to the next screen, the PopupWindow
also got dismissed. Then I applied setWindowLayoutType
and set it to setWindowLayoutType(WindowManager.LayoutParams.TYPE_TOAST);
. It works but only on API 23 and above.
Any ideas on how can I apply this on lower API versions? Thanks.
ps. I don't want to use third party libraries.