How can I get android listview all count ?

Class library usage, coding and language questions.
User avatar
sincoew
Posts: 48
Joined: Mon Nov 19, 2012 7:42 am

How can I get android listview all count ?

Post by sincoew » Tue Jan 08, 2013 6:53 am

Hi,
I need to browse all listview item,
I use ranorex record get below code,

Code: Select all

object obj=ListView.Element.InvokeActionWithText("ScrollToIndex", "10");
and try to look another action,

Code: Select all

int i=ListView.Element.Actions.Count;
but I just get one "touch" action (ActionDescriptor),
and obj=null.

two question,
1. How can I get all listview item count? ( use ListView.Element.count only show screen item count, and no more information when InvokeActionWithText result value)
2. How can I get InvokeActionWithText() another Parameter -> String name? (I search web forum not saw more description about this function parameter.

Thanks a lot.
Best Regards,
Robert Chen.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How can I get android listview all count ?

Post by Support Team » Wed Jan 09, 2013 11:29 am

Hello,

Unfortunately, you couldn't get all list items since they don't exist at the time when you call the method.

Could you please describe more detailed what do you want to know about 'String name' in 'InvokeActionWithText()'?

Regards,
Markus (T)

User avatar
sincoew
Posts: 48
Joined: Mon Nov 19, 2012 7:42 am

Re: How can I get android listview all count ?

Post by sincoew » Wed Jan 09, 2013 1:02 pm

Hi Markus,

I need verify our app can show all item on listview (item dynamic add via network),
so I want to get all item on list view, but I don't know how many item on android listview.

Code: Select all

int endNumber = ?? ;
ListView.Element.InvokeActionWithText("ScrollToIndex", "endNumber");
I want to know InvokeActionWithText has like InvokeActionWithText("ScrollToEnd", "-1") or another function?

#How can I know it's scroll on end?

Thanks you for your help.
Best Regards,
Robert Chen.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How can I get android listview all count ?

Post by Support Team » Thu Jan 10, 2013 2:12 pm

Hello,

Unfortunately, there is not method to scroll to the end of a listview.
You could try to use 'ScrollToIndex' and set the index to 1000 e.g.

There are a few workarounds on stackoverflow:
http://stackoverflow.com/questions/3606 ... g-the-list
http://stackoverflow.com/questions/5123 ... the-bottom

Regards,
Markus (T)