In a few cases, my clients have wanted to disable the hardware back button on a screen or screens and put their own "exit" icon on the screen. This prevents the user from accidentally exiting a screen,say if they are holding a tablet and their thumb slips and/or gives them the ability to throw up an exit confirmation dialog when the layout exit button is clicked. To do this for a particular activity, simply override the onBackPressed() method.
@Override
public void onBackPressed()
{
return;
}