Google+ Followers

Wednesday, 11 November 2015

Useful Calabash Android methods for scrolling, reading and counting items in Android List view


Calabash queries for Android list view


#Get total items in List view
query "ListView",:getCount


#Get first visible item from android list view
query "ListView",:getFirstVisiblePosition


#Get item details at row 2 in current list
query "ListView",{:getItemAtPosition=>1}


#get last visible position of item currently visible in list view
query "ListView",:getLastVisiblePosition


#Scroll in list view
query "ListView",{:smoothScrollToPosition=>5}


#scroll progressively in list view
query "ListView",{:smoothScrollByOffset=>1} # scroll by one position


Example of Android list view - http://developer.android.com/guide/topics/ui/layout/listview.html


5 comments:

  1. Would you know the similar parameter for 'RecyclerView' for the following method?
    query "ListView",{:getItemAtPosition=>1}
    Thanks in advance!

    ReplyDelete
  2. Can you try getChildAt
    query "RecyclerView",{:getChildAt=>1}

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Sorry, but this method doesn't correspond to the index of the entire list. It corresponds just to those elements that are shown.

    ReplyDelete
  5. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving..
    iOS Training in Chennai
    Android Training in Chennai
    php Training in Chennai

    ReplyDelete