/** {@inheritDoc} */
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    inflater.inflate(R.menu.actionbar_toggle_menu, menu);

    // Binds the button
    CompoundButton cBox =
        (CompoundButton)
            menu.findItem(R.id.toggleView).getActionView().findViewById(android.R.id.toggle);
    cBox.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton cb, boolean checked) {
            model.setChecked(checked);
          }
        });

    // Set label text
    ((TextView) menu.findItem(R.id.toggleView).getActionView().findViewById(android.R.id.text1))
        .setText(getArguments().getString(ARG_LABEL_TEXT));

    this.menu = menu;
    updateChecked();
  }
  /** {@inheritDoc} */
  @Override
  public void onResume() {
    super.onResume();

    updateChecked();
  }
  /** {@inheritDoc} */
  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);

    this.model = (ActionBarToggleModel) activity;
  }