TiagoM
TiagoM

Reputation: 3526

Android Method to Enable/Disable Touch Screen

Hi there is thery any way to invoke a method that enables or disables the Touch Screen of Android?

I want this, because I have several buttons on my activity. When the user clicks on a button, it takes a few seconds to start the following activity, and because of that, while waiting that time, I don't want the user to be able to press anything.

I used a boolean that is True at start, then It changes to false when I click on the first button. And to every click on a button I check if the boolean is true...

But the problem is that Visually the user can click the button, it gets that look of being pressed..

So is there any good method that disables the entire touch screen ? And another that enables the entire touch screen ?

Thanks alot in advance ;)

Upvotes: 0

Views: 3754

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006704

But the problem is that Visually the user can click the button, it gets that look of being pressed

Disable the buttons, using setEnabled(false). This will not only prevent the user from clicking on them, but they will visually appear disabled, to let the user know that the user cannot click on them. It is important for the user to get the proper visual feedback about the buttons being disabled (and later enabled).

is thery any way to invoke a method that enables or disables the Touch Screen of Android?

Not really.

Upvotes: 3

Related Questions