How can i block UI from all interactions for some seconds by user in Android?
I would like to know, how to do this with some delay timing like wait(5000);
You can override dispatchTouchEvent
and stop the call to super.dispatchTouchEvent(ev);
Any touch event will have to go through this method before it is handled.
Set a boolean that you control and use it in the method to determine whether you wish to block control.
private boolean stopUserInteractions = false;
public boolean dispatchTouchEvent(MotionEvent ev) {
if (stopUserInteractions) {
return true;
} else {
return super.dispatchTouchEvent(ev);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With