Code example for ActionBarActivity

0
import android.widget.Toast; 
 
/** 
 * Demonstrates how fragments can participate in the options menu. 
 */ 
public class ActionBarFragmentMenu extends ActionBarActivity { 
    MenuFragment mFragment1;
    Menu2Fragment mFragment2;
    CheckBox mCheckBox1;
    CheckBox mCheckBox2;
    CheckBox mCheckBox3;
    CheckBox mHasOptionsMenu;
    CheckBox mMenuVisibility;
 
    // Update fragment visibility when check boxes are changed. 
    final OnClickListener mClickListener = new OnClickListener() {
        @Override 
        public void onClick(View v) { 
            updateFragmentVisibility(); 
        } 
    };