find Accessibility Node Information By Class Name - Android User Interface

Android examples for User Interface:AccessibilityEvent

Description

find Accessibility Node Information By Class Name

Demo Code


//package com.java2s;

import android.text.TextUtils;
import android.view.accessibility.AccessibilityNodeInfo;

public class Main {

    public static AccessibilityNodeInfo findNodeInfosByClassName(
            AccessibilityNodeInfo nodeInfo, String className) {
        if (TextUtils.isEmpty(className)) {
            return null;
        }//w  ww.  java 2s.  c  o m
        for (int i = 0; i < nodeInfo.getChildCount(); i++) {
            AccessibilityNodeInfo node = nodeInfo.getChild(i);
            if (className.equals(node.getClassName())) {
                return node;
            }
        }
        return null;
    }
}

Related Tutorials