@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private void formatTextWithLabel(AccessibilityNodeInfoCompat node,SpannableStringBuilder builder){
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)   return;
  AccessibilityNodeInfo info=(AccessibilityNodeInfo)node.getInfo();
  if (info == null)   return;
  AccessibilityNodeInfo labeledBy=info.getLabeledBy();
  if (labeledBy == null)   return;
  AccessibilityNodeInfoCompat labelNode=new AccessibilityNodeInfoCompat(labeledBy);
  final SpannableStringBuilder labelDescription=new SpannableStringBuilder();
  Set<AccessibilityNodeInfoCompat> visitedNodes=new HashSet<>();
  appendDescriptionForTree(labelNode,labelDescription,null,null,visitedNodes);
  AccessibilityNodeInfoUtils.recycleNodes(visitedNodes);
  if (TextUtils.isEmpty(labelDescription)) {
    return;
  }
  final String labeled=mContext.getString(R.string.template_labeled_item,builder,labelDescription);
  Spannable spannableLabeledText=StringBuilderUtils.createSpannableFromTextWithTemplate(labeled,builder);
  builder.clear();
  builder.append(spannableLabeledText);
}

@ TargetApi ( Build . VERSION_CODES . JELLY_BEAN_MR1 ) private void formatTextWithLabel ( AccessibilityNodeInfoCompat node , SpannableStringBuilder builder ) { if ( Build . VERSION . SDK_INT < Build . VERSION_CODES . JELLY_BEAN_MR1 ) return ; AccessibilityNodeInfo info = ( AccessibilityNodeInfo ) node . getInfo ( ) ; if ( info == null ) return ; AccessibilityNodeInfo labeledBy = info . getLabeledBy ( ) ; if ( labeledBy == null ) return ; AccessibilityNodeInfoCompat labelNode = new AccessibilityNodeInfoCompat ( labeledBy ) ; final SpannableStringBuilder labelDescription = new SpannableStringBuilder ( ) ; Set < AccessibilityNodeInfoCompat > visitedNodes = new HashSet < > ( ) ; appendDescriptionForTree ( labelNode , labelDescription , null , null , visitedNodes ) ; AccessibilityNodeInfoUtils . recycleNodes ( visitedNodes ) ; if ( TextUtils . isEmpty ( labelDescription ) ) { return ; } final String labeled = mContext . getString ( R . string . template_labeled_item , builder , labelDescription ) ; Spannable spannableLabeledText = StringBuilderUtils . createSpannableFromTextWithTemplate ( labeled , builder ) ; builder . clear ( ) ; builder . append ( spannableLabeledText ) ; }
if the supplied node has a label , replaces the builder text with a version formatted with the label .
