Java tutorial
//package com.java2s; import android.text.TextUtils; import android.view.accessibility.AccessibilityNodeInfo; public class Main { public static AccessibilityNodeInfo findParentNodeInfoByClass(AccessibilityNodeInfo nodeInfo, String parentClass) { if (nodeInfo == null || TextUtils.isEmpty(parentClass)) { return null; } if (parentClass.equals(nodeInfo.getClassName())) { return nodeInfo; } return findParentNodeInfoByClass(nodeInfo.getParent(), parentClass); } }