find Accessibility Node Information - Android User Interface

Android examples for User Interface:AccessibilityEvent

Description

find Accessibility Node Information

Demo Code


//package com.java2s;

import android.os.Build;

import android.view.accessibility.AccessibilityNodeInfo;

import java.util.List;

public class Main {

    public static AccessibilityNodeInfo findNodeInfosById(
            AccessibilityNodeInfo nodeInfo, String resId) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
            List<AccessibilityNodeInfo> list = nodeInfo
                    .findAccessibilityNodeInfosByViewId(resId);
            if (list != null && !list.isEmpty()) {
                return list.get(0);
            }/* ww w. j  a v  a  2  s  .  co  m*/
        }
        return null;
    }
}

Related Tutorials