Code example for FragmentActivity

Methods: getLayoutFragmentContainerId, getSupportFragmentManager, onKeyDown

0
		} 
	} 
 
	public boolean onKeyDown(int keyCode, KeyEvent event) {
	    if ((keyCode == KeyEvent.KEYCODE_BACK)) {
	    	FragmentManager fragManager = getSupportFragmentManager();
	    	FragmentTransaction backTransaction = fragManager.beginTransaction();
	    	Fragment frag = fragManager.findFragmentById(getLayoutFragmentContainerId());
	    	if(frag != null) {
	    		backTransaction.detach(frag);
	    		backTransaction.commit();
	    	} 
	    } 
	    return super.onKeyDown(keyCode, event);
	} 
 
    public boolean isReady() { 
        BaseDocumentsListFragment fragment = (BaseDocumentsListFragment) getSupportFragmentManager().findFragmentById(
                getListFragmentContainerId()); 
        return fragment.isReady();
    }