@Override
          public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            actionMode = mode;
            getMenuInflater().inflate(R.menu.account_list_context, menu);

            // This method is invoked both when the user starts the CAB and when the CAB is
            // recreated
            // after an orientation change. In the former case, no list items are checked. In the
            // latter, one of the items is checked.
            // Unfortunately, the Android framework does not preserve the state of the menu after
            // orientation changes. Thus, we need to update the menu.
            if (userList.getCheckedItemCount() > 0) {
              // Assume only one item can be checked, and blow up otherwise
              int position = getMultiSelectListSingleCheckedItemPosition(userList);
              updateCabForAccount(mode, menu, users[position]);
            }

            return true;
          }
Called when the activity is first created.
java/com/google/android/apps/authenticator/AuthenticatorActivity.java