I'm trying to read a listview from getRootInActiveWindow() of AccessibilityService in Android.
AccessibilityNodeInfo topMostNode = getTopMostParentNode(getRootInActiveWindow());
This is how I'm getting the topMostNode in my window, the getTopMostParentNode() function recursively checks and returns the topmost parent node.
The thing is I'm pressing a show more button, which loads 5 more records, initially, it's showing 5 elements in the listview. but when I'm getting all the listView nodes in my root active window, (maybe) I'm not getting the latest screen info. But because of that I'm not getting all items inside the listview only top 5.
So, I'm asking is there something I can do which would help me get all items inside the listview or is there any way from which I can refresh the window for accessibilityService to load.
I've tried topMostNode.refresh() but no help.
This is how I'm getting all listview items:
List<AccessibilityNodeInfo> listViewNodes = new ArrayList<>();
findNodesByClassName(getRootInActiveWindow(), "android.widget.ListView", listViewNodes);
ListView contains multiple listview, which I'm trying to read
Apparently, there is a way to refresh the nodes, with refresh()
function on the AccessibilityNodeInfo
class. With that I refreshed my topMostNode like topMostNode.refresh()
and then It was working as intented.