4

How can we get the current position, or the current item, of the CardScrollView? I have not seen a getCurrentPosition() or public getItem() on CardScrollView or CardScrollAdapter.

Patrick Jackson
  • 18,766
  • 22
  • 81
  • 141

1 Answers1

5

CardScrollView (javadoc link) has the methods getSelectedItem() to return the item associated with the currently selected card, and getSelectedItemPosition() to return its index.

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
  • Yep, `getSelectedItem` workd for me... but make sure that you call `setItemOnCard` in your `CardScrollAdapter`'s `getView` override. Otherwise, `getSelectedItem()` will return null. – brendonparker Mar 26 '14 at 19:42
  • Have you tried replicating this result with the latest GDK release? setItemOnCard is now deprecated. – Clocker May 27 '14 at 17:42