There is an idea to save the battery, and put some processes to sleep if the user does not touch the screen for a long time.
How can I catch an event by touching the screen?
I have a lot of view on the screen, there are also some fragments. And on each element you do not want to hang OnClickListener.
Is there a more humane way, is it possible to catch a request from the sensor?
I will be glad to any ideas.

    1 answer 1

    Create your own variant of the Root Activity , in which all touches are "caught", such as:

     public class MyRootActivity extends Activity { //blah-blah @Override void onUserInteraction() { super.onUserInteraction(); //далее ваш код слушателя } } 

    Now, if all your Activity are inherited from this, then when you touch any element, onUserInteraction() will work - the rest is a matter of technology.

    • Everything works, thank you very much - tosh17