Code example for FragmentActivity

Methods: getMenuInflater, onCreateOptionsMenu

0
		return super.getMenuInflater(); 
	} 
 
	@Override 
	public MenuInflater getMenuInflater() {
		return mActionBarCompat.getMenuInflater(super.getMenuInflater());
	} 
 
	public ActionBar getSupportActionBar() {
		if (mActionBarCompat instanceof ActionBarCompatBase && !mActionBarInitialized) {
			mActionBarInitialized = ((ActionBarCompatBase) mActionBarCompat).setCustomTitleView();
		} 
		return mActionBarCompat.getActionBar();
 
	} 
 
	public void invalidateSupportOptionsMenu() { 
		if (mActionBarCompat instanceof ActionBarCompatNative) {
			MethodsCompat.invalidateOptionsMenu(this);
		} else if (mActionBarCompat instanceof ActionBarCompatBase) {
			((ActionBarCompatBase) mActionBarCompat).invalidateOptionsMenu();
		} 
	} 
 
	@Override 
	public void onAttachFragment(final Fragment fragment) {
		super.onAttachFragment(fragment);
		mAttachedFragment = fragment;
		if (mActionBarCompat instanceof ActionBarCompatBase) {
			((ActionBarCompatBase) mActionBarCompat).createActionBarMenu();
		} 
	} 
 
	@Override 
	public void onBackPressed() { 
		if (mActionBarCompat instanceof ActionBarCompatBase) {
			if (((ActionBarCompatBase) mActionBarCompat).isActionModeShowing() && mActionModeCompat != null) {
				mActionModeCompat.finish();
			} 
		} 
		super.onBackPressed(); 
	} 
 
	@Override 
	protected void onCreate(final Bundle savedInstanceState) {
		if (mActionBarCompat instanceof ActionBarCompatBase) {
			((ActionBarCompatBase) mActionBarCompat).requestCustomTitleView();
		} 
		super.onCreate(savedInstanceState);
	} 
 
	/** 
	 * Base action bar-aware implementation for 
	 * {@link Activity#onCreateOptionsMenu(android.view.Menu)}. 
	 *  
	 * Note: marking menu items as invisible/visible is not currently supported. 
	 */ 
	@Override 
	public boolean onCreateOptionsMenu(final Menu menu) {
		if (mActionBarCompat instanceof ActionBarCompatBase) {
			if (((ActionBarCompatBase) mActionBarCompat).isActionModeShowing() && mActionModeCompat != null)
				return false; 
		} 
		boolean retValue = super.onCreateOptionsMenu(menu);
		if (mActionBarCompat instanceof ActionBarCompatBase) {
			if (mAttachedFragment != null) {
				mAttachedFragment.onCreateOptionsMenu(menu, getMenuInflater());
			} 
			retValue = true;