Lock buttons on the phone, by android studio

1

I have a question. I would like to push a button on the layout created in Android Studio, I could lock the buttons of the phone (volume and on / off). And that he only came back to normal, after I pressed another button on the screen or typed a code. can anybody help me? Many thanks!

I'm using Android Studio 3.1.3

    
asked by anonymous 16.07.2018 / 17:03

1 answer

0

Hello, Dedé!

You can use the setEnabled () method that Button inherits from the super-class View. Through this method you can disable the Button or any class that is subclass of the View class, passing false as a parameter to this method.

For example, if I disable my confirm button, I code like this:

btnConfirmar.setEnabled(false);
    
18.07.2018 / 18:12