Forum Discussion
Ok, no problem. the problem in my opinion is that there is no classic item in the sheet but one row is one Layout see .. this is one line in listView
Mobile.Device("emulator-5554").Process("mobileclient.androidclient.Dev").Layout("NO_ID").Layout("action_bar_root").Layout("content").Layout("vmc_main_content_area").ListView("vmc_screen100_list").Layout("NO_ID")
need to somehow find out which row (Layout) is marked in the sheet. I've been struggling with this for a week but I can't figure it out... 😕
Thank you
Could you try a Record Script test to see how TestComplete is doing it, then post the code output here, along with a screenshot of the item in question from the ObjectBrowser?
Also, please copy the code from here, run it, and post the results here if you can.
function CheckState()
{
// Select an Android device
Mobile.SetCurrent("MyDevice");
// Obtain an application
var app = Mobile.Device("emulator-5554").Process("mobileclient.androidclient.Dev");
// Obtain a listView
var listViewObj = app.RootLayout("").ListView("vmc_screen100_list");
// or app.RootLayout("").Layout("vmc_main_content_area").ListView("vmc_screen100_list")
for (i=0; i < listViewObj.wItemCount; i++)
{
// Check the item’s state
if (listViewObj.wSelected(i))
{
Log.Message(listViewObj.wItem(i) + " item is checked");
}
else
{
Log.Message(listViewObj.wItem(i) + " is not checked");
}
}
// Obtain the index of item with focus
var focus = listViewObj.wFocus;
if (focus == -1)
{
Log.Message("There are no focused items.");
}
else
{
Log.Message("The index of the focused item is " + focus);
}
}
- David912 years agoFrequent Contributor
Hi Kitt,
although I already tried these methods, but I ran your script above my listview. Unfortunately, he didn't catch anything..
I think it's the way I write.. it's not a classic ITEM, but a Layout, which are like individual lines..
Photo listView
- AlexKaras2 years agoChampion Level 3
Hi,
Is this a standard ListView provided by Android OS or some custom descendant? In the latter case you have two options:
a) Talk to your developers and ask them how selected item can be identified;
b) Explore selected and not selected item in the Object Browser and figure out what property or method can be used to identify the selected item.
Related Content
- 4 years ago
- 6 years ago
- 10 years ago
- 3 years ago
Recent Discussions
- 7 minutes ago
- 23 hours ago
- 7 days ago
- 11 days ago