find Parent Accessibility Node Information By Class Name - Android User Interface

Android examples for User Interface:AccessibilityEvent

Description

find Parent 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 findParentNodeInfosByClassName(
            AccessibilityNodeInfo nodeInfo, String className) {
        if (nodeInfo == null) {
            return null;
        }//from   w  w  w  .ja  v  a 2s. com
        if (TextUtils.isEmpty(className)) {
            return null;
        }
        if (className.equals(nodeInfo.getClassName())) {
            return nodeInfo;
        }
        return findParentNodeInfosByClassName(nodeInfo.getParent(),
                className);
    }
}

Related Tutorials