/**
   * This is where we perform additional setup for the fragment that's either not related to the
   * fragment's layout or must be done after the layout is drawn.
   */
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Set member variable for whether this fragment is the only one in the activity
    Fragment listFragment = getFragmentManager().findFragmentById(R.id.titles_frag);
    mSoloFragment = listFragment == null ? true : false;

    if (mSoloFragment) {
      // The fragment is alone, so enable up navigation
      getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
      // Must call in order to get callback to onOptionsItemSelected()
      setHasOptionsMenu(true);
    }

    // Current position and UI visibility should survive screen rotations.
    if (savedInstanceState != null) {
      setSystemUiVisible(savedInstanceState.getBoolean("systemUiVisible"));
      if (mSoloFragment) {
        // Restoring these members is not necessary when this fragment
        // is combined with the TitlesFragment, because when the TitlesFragment
        // is restored, it selects the appropriate item and sends the event
        // to the updateContentAndRecycleBitmap() method itself
        mCategory = savedInstanceState.getInt("category");
        mCurPosition = savedInstanceState.getInt("listPosition");
        updateContentAndRecycleBitmap(mCategory, mCurPosition);
      }
    }

    if (mSoloFragment) {
      String title = Directory.getCategory(mCategory).getEntry(mCurPosition).getName();
      ActionBar bar = getActivity().getActionBar();
      bar.setTitle(title);
    }
  }
  /**
   * Sets the current image visible.
   *
   * @param category Index position of the image category
   * @param position Index position of the image
   */
  void updateContentAndRecycleBitmap(int category, int position) {
    mCategory = category;
    mCurPosition = position;

    if (mCurrentActionMode != null) {
      mCurrentActionMode.finish();
    }

    if (mBitmap != null) {
      // This is an advanced call and should be used if you
      // are working with a lot of bitmaps. The bitmap is dead
      // after this call.
      mBitmap.recycle();
    }

    // Get the bitmap that needs to be drawn and update the ImageView
    mBitmap = Directory.getCategory(category).getEntry(position).getBitmap(getResources());
    ((ImageView) getView().findViewById(R.id.image)).setImageBitmap(mBitmap);
  }