Alert Box

Pressing the Android Back button on the app's home screen, or main menu,
pops up an alert box asking if the user is really sure he will quit.
However, selecting yes still takes the user to the app's splash screen
and the device's home screen. The alert box is done by creating an
AlertDialogue.Builder object and using its setTitle, setMessage,
setNegativeButton and setPositiveButton methods.

Source:
http://stackoverflow.com/questions/6413700/android-proper-way-to-use-onbackpressed