Example usage for android.view View getLabelFor

List of usage examples for android.view View getLabelFor

Introduction

In this page you can find the example usage for android.view View getLabelFor.

Prototype

@ViewDebug.ExportedProperty(category = "accessibility")
public int getLabelFor() 

Source Link

Document

Gets the id of a view for which this view serves as a label for accessibility purposes.

Usage

From source file:com.google.android.apps.common.testing.accessibility.framework.ViewAccessibilityUtils.java

private static View lookForLabelForViewInViewAndChildren(View view, View childToSkip, int idToFind) {
    if (view.getLabelFor() == idToFind) {
        return view;
    }/*from   www.  j  a  v a 2  s  .c  om*/
    if (!(view instanceof ViewGroup)) {
        return null;
    }
    ViewGroup viewGroup = (ViewGroup) view;
    for (int i = 0; i < viewGroup.getChildCount(); ++i) {
        View child = viewGroup.getChildAt(i);
        if (!child.equals(childToSkip)) {
            View labelingView = lookForLabelForViewInViewAndChildren(child, null, idToFind);
            if (labelingView != null) {
                return labelingView;
            }
        }
    }
    return null;
}