Code example for FragmentActivity

Methods: onKeyLongPress

0
    public boolean onKeyLongPress(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            goHome(); 
            return true; 
        } 
        return super.onKeyLongPress(keyCode, event);
    } 
 
    public void goHome() { 
        if (this instanceof HomeActivity) {
            return; 
        } 
 
        final Intent intent = new Intent(this, HomeActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        finish(); 
    } 
 
    /**