Hi Boxers, I'm trying to implement a "press twice to exit" behavior for the back button on Android devices. I'm experiencing different results when pressing the back button on my game: sometimes it goes back to the previous screen, sometimes it exits the game and sometimes it does nothing and then opens a recent opened app . What I'm trying to achieve is having the back button display a toast message like "Press again to exit" on all my game screens, so I don't have to deal with the back button. I've seen this behavior in games like Wall Switch. I tried following the example below and modify my PTPlayer java file but I cannot get it working, and my Android knowledge is limited. Any help is appreciated. Thanks! Here's my code: Code: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.hideVirtualButton(); PTServicesBridge.initBridge(this, getString( R.string.app_id )); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } // Press twice to exit private static final int TIME_LIMIT = 1500; private static long backPressed; @Override public void onBackPressed() { if (TIME_LIMIT + backPressed > System.currentTimeMillis()){ super.onBackPressed(); } else { Toast.makeText(getApplicationContext(), "Press again to exit",Toast.LENGTH_SHORT).show(); } backPressed = System.currentTimeMillis(); } Here's the example: