@Override
 public int getElements(View v) {
   int nelems = 0;
   // one element for the widget
   nelems++;
   // one element for each word in the text
   String text = (String) ((Button) v).getText();
   nelems += StringUtils.countWords(text);
   return nelems;
 }
  @Override
  public int getElements(View v) {
    int nelems = 0;

    // one element for the widget
    nelems++;
    // one element for each word in the text
    CharSequence text = ((TextView) v).getText();
    nelems += StringUtils.countWords(text.toString());

    return nelems;
  }