Example #1
0
  private void updateTitle() {
    final String newTitle = getTitle();
    if (newTitle == null) {
      Log.d(LOGTAG, "No new title to show.");
      return;
    }

    final PreferenceActivity activity = (PreferenceActivity) getActivity();
    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) && activity.isMultiPane()) {
      // In a multi-pane activity, the title is "Settings", and the action
      // bar is along the top of the screen. We don't want to change those.
      activity.showBreadCrumbs(newTitle, newTitle);
      return;
    }

    Log.v(LOGTAG, "Setting activity title to " + newTitle);
    activity.setTitle(newTitle);

    if (Build.VERSION.SDK_INT >= 14) {
      final ActionBar actionBar = activity.getActionBar();
      if (actionBar != null) {
        actionBar.setTitle(newTitle);
      }
    }
  }