Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android listview first visible position [duplicate]

How can I change the first visible item in a list view (I searched a method such as setFirstVisiblePosition) ?

like image 770
Arutha Avatar asked Jan 11 '10 10:01

Arutha


2 Answers

ListView.getFirstVisiblePosition()  

Returns the position within the adapter's data set for the first item displayed on screen. Once you have the position, you can alter the item at that position in your adapter.

Presume my Adapter is binding a String[] to a ListView. I can use getFirstVisiblePosition() method on the listview instance, which will return the index/position of the first visible item, I can then change my String item at the "index"th position and alter the list.

like image 144
Samuh Avatar answered Sep 18 '22 04:09

Samuh


Have a look at this question.

like image 40
Dave Webb Avatar answered Sep 19 '22 04:09

Dave Webb