Code example for FragmentActivity

Methods: findViewById, getLayoutFragmentContainerId, onStart

0
	public BaseListFragmentActivity() { 
	} 
 
	@Override 
	protected void onStart() { 
		super.onStart(); 
		if (findViewById(getLayoutFragmentContainerId()) != null) { 
			mTwoPane = true;
		} 
	} 
 
	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();
	    	} 
	    }