Closing application with BACK PRESS two times

Hi people what’s up?

I don’t know if someone tried use back press two times to close an application, I’m sharing how I do this and if someone have another kind please share with us :slight_smile:



This post is less look like a Discussion more like a Guide. So, please change your post category.

1 Like

You have to use a click otherwise if by mistake you touch the backpress button even after some time and the app closes.
The procedure is more or less this:
Variable back = false
When click on back press a two second timer starts and back becomes true
If in the meantime press backpress again a loop if check the variable back if it is = true it closes the app in the meantime passed and 2 seconds back becomes = false and you have to start again.
Unfortunately I do not have a PC available at the moment explained with the blocks is very simple.




No need to use variables for this:

(Set this clock to 2000 ms)


I prefer 500 ms since that is a more widely accepted BackPress Delay.

However with the Gesture Navigation systems available now, double backpresses are becoming obsolete and hamper the UX.


500 ms is half second. How are you going to read the notification and press the back button in half second? Besides the toast notification time is 2 seconds (2000 ms) so it matches.

1 Like

i am using this way also,

1 Like

I just double tap by instinct (but of course not on gesture navigation, which breaks the age old navigation practices). Personal preference: I feel the 2000ms delay allows for more inadvertent quitting… Of course the delay is up to the programmer; that’s the beauty of it. I do agree on what you said about the delay matching up to the notifier delay.

1 Like

Ok, that’s cool if the app is only for you and you know you have to press back really quick, but when you make an app for the public, better follow the standards and the standard is 2 seconds, as you can see here: java - Clicking the back button twice to exit an activity - Stack Overflow


Thanks for the information! :smile:


cool tip, thx for sharing

It wasn’t a question. The original poster shared his way of doing it and he asked everyone else to show their way. I don’t think a solution was needed here.

1 Like

A guide on what?

1 Like

Sorry, Wrong post

1 Like