For an App I am working on, I\'m trying to get the children of a ListView. To do this I have the following piece of code:
View listItem = mListView.getChildA
You can use this code
private static void initRecyclerBin(AbsListView view) {
try {
Field localField = AbsListView.class.getDeclaredField("mRecycler");
localField.setAccessible(true);
Object recyclerBin = localField.get(view);
Class> clazz = Class.forName("android.widget.AbsListView$RecycleBin");
Field scrapField = clazz.getDeclaredField("mScrapViews");
scrapField.setAccessible(true);
ArrayList[] scrapViews;
scrapViews = (ArrayList[]) scrapField.get(recyclerBin);
if (null != scrapViews) {
int length = scrapViews.length;
for (int i = 0, count = 0; i < length; i++) {
if (null != scrapViews[i] && !scrapViews[i].isEmpty()) {
for (int j = 0; j < scrapViews[i].size(); j++) {
scrapViews[i].get(j);//this is the scrapViews
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
and ListView getChildViews().