How to close a Dialog after certain seconds of inactivity?
i have an app that contains a dialog i want to close this dialog after x second, when user haven't any interact with app, like volume seekbar popup(that's open when the volume button clicked, and closed after 2 second of inactivity). what is the simplest way to implement this? thank you You could for example use a Handler and call its .removeCallbacks() and .postDelayed() method everytime the user interacts with the dialog. Upon an interaction, the .removeCallbacks() method will cancel the execution of .postDelayed(), and right after that, u start a new Runnable with .postDelayed() Inside this