ishandutta2007
ishandutta2007

Reputation: 18194

Execute a method when a view inside an activity is visible to the user?

I have a list of thumbnails , when a user scrolls over to a thumbnail, I want to perform some actions corresponding to that thumbnail. How can I do this ?

Upvotes: 0

Views: 37

Answers (1)

Dishonered
Dishonered

Reputation: 8841

You can check the last visible and first visible positions in the list view and perform actions accordingly. Suppose your listView is listView.

You can do this

listView.getLastVisiblePosition() to get the last visible position and listView.getFirstVisiblePosition() to get the first visible position.

Upvotes: 2

Related Questions