private void updateActionMode(){
  if (mActionMode != null) {
    int count=mGrid.getCheckedItemCount();
    if (count > 0) {
      mActionMode.setTitle(getString(R.string.n_selected,count));
      if (count > 1) {
        mShare.putExtra(EXTRA_SUBJECT,getString(R.string.restaurants_share));
      }
      StringBuilder text=new StringBuilder(192 * count);
      for (      int i : SparseArrays.trueKeys(mGrid.getCheckedItemPositions())) {
        if (text.length() > 0) {
          text.append("\n");
        }
        EasyCursor c=(EasyCursor)mGrid.getItemAtPosition(i);
        for (        String field : sShareFields) {
          String detail=c.getString(field);
          if (count == 1 && field.equals(Restaurants.NAME)) {
            mShare.putExtra(EXTRA_SUBJECT,detail);
          }
          if (!TextUtils.isEmpty(detail)) {
            if (text.length() > 0) {
              text.append("\n");
            }
            text.append(detail);
          }
        }
      }
      mShare.putExtra(EXTRA_TEXT,text.toString());
    }
  }
}

private void updateActionMode ( ) { if ( mActionMode != null ) { int count = mGrid . getCheckedItemCount ( ) ; if ( count > 0 ) { mActionMode . setTitle ( getString ( R . string . n_selected , count ) ) ; if ( count > 1 ) { mShare . putExtra ( EXTRA_SUBJECT , getString ( R . string . restaurants_share ) ) ; } StringBuilder text = new StringBuilder ( 192 * count ) ; for ( int i : SparseArrays . trueKeys ( mGrid . getCheckedItemPositions ( ) ) ) { if ( text . length ( ) > 0 ) { text . append ( "\n" ) ; } EasyCursor c = ( EasyCursor ) mGrid . getItemAtPosition ( i ) ; for ( String field : sShareFields ) { String detail = c . getString ( field ) ; if ( count == 1 && field . equals ( Restaurants . NAME ) ) { mShare . putExtra ( EXTRA_SUBJECT , detail ) ; } if ( ! TextUtils . isEmpty ( detail ) ) { if ( text . length ( ) > 0 ) { text . append ( "\n" ) ; } text . append ( detail ) ; } } } mShare . putExtra ( EXTRA_TEXT , text . toString ( ) ) ; } } }
update the actionmode title and prepare the share intent .
