Reputation: 869
I want to disable touch input in an activity during certain conditions. Is there any way to accomplish disable touch?
Upvotes: 4
Views: 12094
Reputation: 183
To disable touch events on an activity:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
To re-enable touch events:
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
Upvotes: 2
Reputation: 2114
Get the view that you want to disable the touch inputs on and setOnTouchListener(null)
Upvotes: 1