onBackPressed is a function called in the Android operating system when the user presses the back key.
onBackPressed is a function called in the Android operating system when the user presses the back key. By default the operating system simply finishes the currently active Android Activity, but it is possible to override the function to do whatever you want, including keeping the current Activity open.