Android: enumerating all items in a ListView (even the off-screen ones).
On Android I can access a ListView and select any of its items (even the none visible ones) without any problem:
var RefListView = "Aliases.Device.Process_qv.RootLayout.View_drawer_layout.ListView('channel_lists')"; var ObjListView = eval(RefListView); var ItemCount = ObjListView.wItemCount; ObjListView.SelectItem(12); // Works OK; even on invisible Items [0 - wItemCount-1]
However, I want an inventory of all the names of the list items. Each item in the listview has 3 subitems. The subitem I'm interested in looks like below (I used the 5th ListView Item as example here):
Aliases.Device.Process_qv.RootLayout.View_drawer_layout.ListView('channel_lists').Layout('NO_ID', 4).TextView('text1')
So I use following code to read the 'text1' field from all items in the ListView:
for (var ItemIndex=1; ItemIndex <= ItemCount; ItemIndex++) { var RefItem = "Aliases.Device.Process_qv.RootLayout.View_drawer_layout.ListView('channel_lists').Layout('NO_ID', PLACEHOLDER_INDEX).TextView('text1')"; var ObjItem = eval(RefItem.replace("PLACEHOLDER_INDEX", ItemIndex)); Log.Message("ObjItem" + ItemIndex + ":Text=" + ObjItem.mText); }
Unfortunately, this only works for the items that are currently on the screen, but not for the ones that are currently outside the view. What is the recommended method for making an inventory of ALL listItems, including the ones currently not on screen? I read about using 'listviewObj.smoothScrollToOffset' to reach items that are out of the screen (viewarticle/74368/). But when I try this on my listviewObj I get "object does not support this action".
Thanks for your help,